以下是取8個亂數不重複
Dim arr(7) As Integer
Dim temp As Integer
Dim rnd As New Random
Dim i As Integer
For i = 0 To 7
temp = rnd.Next(1, 9)
While System.Array.IndexOf(arr, temp) <> -1
temp = rnd.Next(1, 9)
End While
arr(i) = temp
Next i
沒有留言:
張貼留言