I am trying to create an array of random numbers - with values between 0 and 188. I want the numbers ordered randomly, but I want to make sure that every number is used once. Here's what I have, which loops endlessly trying to land on the last exact numbers...
Thanks for any help!
-- Just trying to help... LOL
Code:
Dim i As Integer
Dim j As Integer
Dim randomNumber As Integer
Randomize
For i = 0 To 188
numArr(i) = -1
Next
i = 0
Do While i <= 188
randomNumber = Round(188 * Rnd(1), 0)
For j = 1 To UBound(numArr)
If randomNumber = numArr(j) Then
Exit For
ElseIf numArr(j) = -1 Then
numArr(j) = randomNumber
i = i + 1
Exit For
End If
Next
Loop
Thanks for any help!
-- Just trying to help... LOL