I am trying to randomise 5 variables as integers between 1 and 5, but make it so that each variable cannot be equal. I can currently randomise the numbers, but some end up being the same. When I added code that randomises the series of numbers until they are not equal, it just ends up freezing. Any help is appreciated, thanks.
Here is my code:
Dim rndnum As Random
Dim qcombo As Boolean = False
Dim q1 As Integer
Dim q2 As Integer
Dim q3 As Integer
Dim q4 As Integer
Dim q5 As Integer
rndnum = New Random
Do
q1 = rndnum.Next(1, 5)
q2 = rndnum.Next(1, 5)
q3 = rndnum.Next(1, 5)
q4 = rndnum.Next(1, 5)
q5 = rndnum.Next(1, 5)
If q1 = q2 Or q1 = q3 Or q1 = q4 Or q1 = q5 Or q2 = q3 Or q2 = q4 Or q2 = q5 Or q3 = q4 Or q3 = q5 Or q4 = q5 Then
qcombo = False
Else
qcombo = True
Loop Until qcombo = True