1000个数随机产生20组不重复

用的是CSDN上一个高手的思想。

<%
Redim A_StrA(1000)
For i = 0 To 999
 A_StrA(i) = i
Next
s_Str = ""
m = 0
n = 1
Randomize timer
For i = 0 To 1000
 i_Rnd = Fix(Rnd * (999 - i + 1))
 If m = 50 Then
  Response.Write n&":"&s_Str&"<br>"
  If n = 20 Then
   Exit For
  End If
  n = n + 1
  m = 1
  s_Str = ""
 Else
  m = m + 1
 End If
 If s_Str <> "" Then
  s_Str = s_Str & ","
 End If
 For j = Len(A_StrA(i_Rnd)) To 2
  s_Str = s_Str & "0"
 Next
 s_Str = s_Str & A_StrA(i_Rnd)
 For k = i_Rnd To 999
  A_StrA(k) = A_StrA(k + 1)
 Next
Next
%> 

你可能感兴趣的:(timer)