📜  在 vb.net 中获取唯一的随机数 - BASIC 代码示例

📅  最后修改于: 2022-03-11 14:52:01.984000             🧑  作者: Mango

代码示例2
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