Foxtable(狐表)用户栏目专家坐堂 → [求助]随机组合出现重复怎么办?


  共有2227人关注过本帖树形打印复制链接

主题:[求助]随机组合出现重复怎么办?

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/7 14:12:00 [显示全部帖子]

Dim a() As String = {"张","林","陈","王","李"}
Dim b() As String = {"建国","国庆","旺财"}
Dim c() As String = {"男","女"}
Dim ls As new List(Of String)
For Index As Integer = 0 To 10
    Dim s As String = a(rand.Next(0,5)) & b(rand.Next(0,3)) & c(rand.Next(0,2))
    If ls.Contains(s) = False
        ls.add(s)
        Output.Show(s)
    Else
        index -= 1
    End If
Next

 回到顶部