Alright, I'm trying to generate an ODD random number between 1 and 8.
Do While (i < 4)
box(i) = randomObject.Next(1, 8)
Do While (flag = 0)
If (box(i) Mod 2 = 0) Then
k = 0
box(i) = randomObject.Next(1, 8)
If (box(i) = box(k + 1)) Then
box(i) = randomObject.Next(1, 8)
ElseIf (box(i) = box(k + 2)) Then
box(i) = randomObject.Next(1, 8)
ElseIf (box(i) = box(k + 3)) Then
box(i) = randomObject.Next(1, 8)
Else
box(i) = box(i)
End If
Else
k = 0
If (box(i) = box(k + 1)) Then
box(i) = randomObject.Next(1, 8)
ElseIf (box(i) = box(k + 2)) Then
box(i) = randomObject.Next(1, 8)
ElseIf (box(i) = box(k + 3)) Then
box(i) = randomObject.Next(1, 8)
Else
Exit Do
End If
End If
flag = 1
Loop
i = i + 1
Loop
What I'm having trouble with is that the numbers MUST be unique. So, only one 1, one 3, one 5, one 7. So I have it go through the second statements to randomize the object again if it's the same, but after it randomizes, I kind of need it to go back to the top to see if the number is even again. I've been working on this for hours and I'm a bit frustrated.
Can anyone point me in the right direction with this, please?