从100个数字中按照随机顺序遍历,不会重复选择,不用判断语句

来源:互联网 发布:集线器端口 编辑:程序博客网 时间:2024/04/30 14:24

Private Sub Command1_Click()
Dim A(9) As Long
Dim X As Long
Dim I As Long
Dim L As Long
Me.Cls
For I = 0 To 9
   A(I) = I
Next I
For I = 9 To 0 Step -1
   X = Int(I * Rnd)
   Me.Print A(X)
   L=A(X)
   A(X) = A(I)
   A(I)=L
Next
End Sub 

http://community.csdn.net/Expert/topic/4985/4985999.xml?temp=.9327967

原创粉丝点击