VBS 生成不重复随机数代码[0-10]
2026-01-17 14:47:48 作者:用户投稿
复制代码 代码如下:
dim Z(10),i
for i=0 to 10
Z(I)=GetRnd(i-1)
WScript.Echo (Z(i))
NEXT
Function GetRnd(n)
Dim i,X
Randomize
X=CInt(10*Rnd() )
For i=0 To n
If X=Z(i) Then
X=GetRnd(n)
Exit For
End If
Next
GetRnd=X
End Function
dim Z(10),i
for i=0 to 10
Z(I)=GetRnd(i-1)
WScript.Echo (Z(i))
NEXT
Function GetRnd(n)
Dim i,X
Randomize
X=CInt(10*Rnd() )
For i=0 To n
If X=Z(i) Then
X=GetRnd(n)
Exit For
End If
Next
GetRnd=X
End Function
联络方式:
4008905355
邮箱:9196886@qq.com
Q Q:9196886
微信二维码
