ASP随即数

来源:百度知道 编辑:UC知道 时间:2024/05/18 00:04:02
ASP中
假如用到随即数0000-9999的话 该怎么写?
必须是4位的
比如说1必须是0001的
可以吗?

randomize timer
response.write cint(9999*rnd)

<%
Randomize
a=int(rnd()*10000)
%>

有点不记得了,应该是rnd(1)*9999吧。。
如果要整数的话,就加个int吧。

-----------------------------------------------------------
晕了,这个可麻烦了,我不是很清楚

可不可以这样
<%
Randomize
a=int((9999*rnd)+1)
b=len(a)
select case b
case 1
a=000&a
case 2
a=00&a
case 3
a=0&a
case 4
a=0
end select
Response.write(a)
%>
欢迎到群37025916,大家一起商量