我要做的是创建一个RNG按钮,它将在1-99之间生成5个唯一的数字。这就是我到目前为止所做的:
Private Sub GenerateButton_Click(sender As Object, e As EventArgs) Handles GenerateButton.Click
Dim rand As New Random()
Dim rememberset As New HashSet(Of Integer)
Dim value As Integer
While rememberset.Count < 6
value = rand.Next(1, 99)
If rememberset.Add(value) Then
LotteryLabel.Text = value.ToString()
End If
End While
End Sub
每次点击“生成”按钮,我只得到1个数字。我试图以这种格式显示5(1,2,3,4,5)。有任何想法吗?感谢。
答案 0 :(得分:1)
你的LotteryLabel.Text总是设置为只有一个数字的字符串(我想你只会看到最后一个数字)
您需要附加值:Easy(但可能很慢)解决方案应该是
tokens([ttwhile | Z]) --> "while", tokens(Z).
tokens([ttdo | Z]) --> "do", tokens(Z).
tokens([endwhile | Z]) --> "endwhile", tokens(Z).
tokens([ttrepeat | Z]) --> "repeat", tokens(Z).
tokens([ttuntil | Z]) --> "until", tokens(Z).
tokens([ttendrepeat | Z]) --> "endrepeat", tokens(Z).
tokens([if | Z]) --> "if", tokens(Z).
tokens([then |Z]) --> "then", tokens(Z).
tokens([ttelse | Z]) --> "else", tokens(Z).
tokens([ttendif | Z]) --> "endif", tokens(Z).
tokens([ttexit | Z]) --> "exit", tokens(Z).
tokens([ttother | Z]) --> "other", tokens(Z).
% Comparison operators.
tokens([equal | Z]) --> "==", tokens(Z).
tokens([notequal | Z]) --> "<>", tokens(Z).
% Assignment operator.
tokens([:= | Z]) --> ":=", tokens(Z).
% Boolean constants and operators.
tokens([true | Z]) --> "true", tokens(Z).
tokens([false | Z]) --> "false", tokens(Z).
tokens([and | Z]) --> "and", tokens(Z).
tokens([or | Z]) --> "or", tokens(Z).
tokens(Z) --> " ", tokens(Z).
tokens([X | Z]) --> [C], tokens(Z), {name(X, [C])}.
tokens([]) --> [].