<%
'生成10个7到30间的不重复随机数
response.write RandomizeNum(10,7,30)
%>
<%
'生成规定范围内的多个不重复数字
Function RandomizeNum(count,lownum,highnum)
If highnum<count then
exit function
End If
redim n(count)
Dim i,q
Dim isok
For i=1 to count
Randomize
n(i)=round((highnum-lownum)* Rnd)+lownum
isok=false
Do while not isok
For q=1 to i
If n(i)=n(q-1) then
n(i)=Int((highnum-lownum)* Rnd)+lownum
isok=false
exit for
End If
isok=true
Next
Loop
If i=count Then
RandomizeNum = RandomizeNum& n(i)
Else
RandomizeNum = RandomizeNum & n(i) &","
End If
Next
end Function
%>