取三个:
Dim vals() As String = {"1","2","3","4","5"}Dim str As String = ""Do Dim idx As Integer = rand.Next(0,vals.Length) If str.Contains(vals(idx)) = False Then str = str & vals(idx) End IfLoop While str.Length < 3 Return str
你去多少个都行,你要做的将下面的3改为其他数字:
Loop While str.Length < 3
当然3不能大于数组的长度