Answers for "get unique random number in vb.net"

0

get unique random number in vb.net

Dim numbers = Enumerable.Range(0, 11).ToList()
Dim RandomClass As New Random()
Dim RandomIndex As Integer
For counter As Integer = 1 To 5
    RandomIndex = RandomClass.Next(0, numbers.Count)
    MsgBox(numbers(RandomIndex))
    numbers.RemoveAt(RandomIndex)
Next
Posted by: Guest on November-28-2020
0

get unique random number in vb.net

Dim RandomClass As New Random()
Dim RememberSet As New HashSet(Of Integer)

Dim RandomNumber As Integer

While RememberSet.Count < 5
    RandomNumber = RandomClass.Next(0, 10)
    If RememberSet.Add(RandomNumber) Then
        MsgBox(RandomNumber)
    End If
End While
Posted by: Guest on November-28-2020

Code answers related to "get unique random number in vb.net"

Code answers related to "BASIC"

Browse Popular Code Answers by Language