Hello, what the following code is ment to do is generate a bunch of numbers between 1 and 49 using the while loop to check if two of these numbers are the same. Problem is two numbers are still being generated the same and I know that the numbers generated again will not match them originals so it stops the loop.
PS: I don't want to use .contains.
VB.NET:
Dim temp As Integer = 0
For a = 0 To 5
ballbox(a) = rnd.Next(1, 49)
bonusball = rnd.Next(1, 49)
temp = ballbox(a)
While (ballbox(a) = temp) 'its not going to be the same again so it breaks the while loop
ballbox(a) = rnd.Next(1, 49)
End While
While (bonusball = ballbox(a))
bonusball = rnd.Next(1, 49)
End While
Next
PS: I don't want to use .contains.
Last edited: