Foxtable(狐表)用户栏目专家坐堂 → [求助]字符的随机显示


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

主题:[求助]字符的随机显示

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/18 9:59:00 [显示全部帖子]

Dim str() As String = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "+", "-", "*", "/", ">"}
For i As Integer = 1 To str.Length '洗牌测次数
    Dim rnum1 As Integer = Rand.Next(str.Length)
    Dim rnum2 As Integer = Rand.Next(str.Length)
    Dim temp As String = str(rnum1)
    str(rnum1) = str(rnum2)
    str(rnum2) = temp   
Next
Dim data As String = String.Join("", str)
For i As Integer = 1 To str.Length '洗牌测次数
    Dim rnum1 As Integer = Rand.Next(str.Length)
    Dim rnum2 As Integer = Rand.Next(str.Length)
    Dim temp As String = str(rnum1)
    str(rnum1) = str(rnum2)
    str(rnum2) = temp   
Next
data &= String.Join("", str)
msgbox(data)

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/18 10:21:00 [显示全部帖子]

以下是引用weijun在2014-7-18 10:12:00的发言:
请问有点甜老师,定义成30是哪句代码?能指点下吗?谢谢!

 

比如,你定义了10个字符,那么生成随机25字符,就应该是 10个+10个+(10个-5个)

 

上面的代码,每次15个,生成两次,就是30个。


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/18 11:42:00 [显示全部帖子]

Dim str() As String = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "+", "-", "*", "/", ">"}
For i As Integer = 1 To str.Length '洗牌测次数
    Dim rnum1 As Integer = Rand.Next(str.Length)
    Dim rnum2 As Integer = Rand.Next(str.Length)
    Dim temp As String = str(rnum1)
    str(rnum1) = str(rnum2)
    str(rnum2) = temp   
Next
Dim data As String = String.Join("", str)
For i As Integer = 1 To str.Length '洗牌测次数
    Dim rnum1 As Integer = Rand.Next(str.Length)
    Dim rnum2 As Integer = Rand.Next(str.Length)
    Dim temp As String = str(rnum1)
    str(rnum1) = str(rnum2)
    str(rnum2) = temp   
Next
data &= String.Join("", str)
msgbox(data.Substring(0,25))

 回到顶部