Dim r As New Random
Dim A(2) As String
A(0) = "A"
A(1) = "B"
A(2) = "C"
MsgBox(A(r.Next(0,3)) & "," & A(r.Next(0,3)) & "," & A(r.Next(0,3)))
I want to see in the result one of the following rows:
A,B,C
A,C,B
C,B,A
C,A,B
B,A,C
B,C,A
Dim r As New Random
Dim A(2) As String
A(0) = "A"
A(1) = "B"
A(2) = "C"
MsgBox(A(r.Next(0,3)) & "," & A(r.Next(0,3)) & "," & A(r.Next(0,3)))
I want to see in the result one of the following rows:
A,B,C
A,C,B
C,B,A
C,A,B
B,A,C
B,C,A
Sort the array in a random order and then go to 0, 1, 2.
Dim r As New Random
Dim A(2) As String
A(0) = "A"
A(1) = "B"
A(2) = "C"
A = A.OrderBy(Function() r.Next).ToArray()
MsgBox(A(0) & "," & A(1) & "," & A(2)
A = A.OrderBy(Function() rnd.Next)