While this may not be a direct answer it should serve to clarify a few things.
The Random Constructor - as I stated in the comments, using New Random(5)
does not generate a sequence of 5 random numbers for you. It simply sets the seed for your random number generator. This means that the sequence of numbers that you generate when calling Random.Next()
will follow the same pattern as they all have the same seed (see example).
Note: Ideally, when creating a New Random()
do not set a seed value. They current time will be used as the default seed.
Creating a New Random(x) inside a loop with a defined seed
'Since random is declared inside the loop, using the same seed value
'each time the loop executes, the same random sequence would be generated.
'Random.Next() will then continually access the first value in the sequence.
For i = 1 To 5
Dim rnd As New Random(5)
TextBox1.AppendText($"{rnd.Next(0, 11)} | ")
Next
Output: 3 | 3 | 3 | 3 | 3
Creating a New Random(x) outside of the loop with a defined seed
'Since random is now declared outside the loop, and Random.Next() is called
'inside the loop, the output sequence actually progresses.
'Note that the first number is the same as the previous example as the seed is the same.
Dim rnd As New Random(5)
For i = 0 To 5
TextBox1.AppendText($"{rnd.Next(0, 11)} | ")
Next
Output: 3 | 3 | 2 | 6 | 5 | 10
Creating multiple instances of New Random(x) all with the SAME seed
'Instance 1
Dim rnd1 As New Random(5)
For i = 0 To 5
TextBox1.AppendText($"{rnd1.Next(0, 11)} | ")
Next
'Instance 2
Dim rnd2 As New Random(5)
For i = 0 To 5
TextBox2.AppendText($"{rnd2.Next(0, 11)} | ")
Next
Instance 3
Dim rnd3 As New Random(5)
For i = 0 To 5
TextBox3.AppendText($"{rnd3.Next(0, 11)} | ")
Next
Instance 1 Output: 3 | 3 | 2 | 6 | 5 | 10
Instance 2 Output: 3 | 3 | 2 | 6 | 5 | 10
Instance 3 Output: 3 | 3 | 2 | 6 | 5 | 10
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…