如何使用VB生成随机数组
生成10000个随机数组,数组形式是这样:第一部分为三位数字.从000300,第二部分为五位字符串,由数字和字符组成,前后两部分之间以空格相隔。例如:2313rp35v...
生成10000个随机数组,数组形式是这样:第一部分为三位数字.从 000 300,第二部分为五位字符串,由数字和字符组成, 前后两部分之间以空格相隔。例如:231 3rp35v
展开
1个回答
展开全部
Private Sub Form_Load()
Dim arr(9999) As String
Dim a(35) As String
For i = 0 To 9
a(i) = Chr(48 + i)
Next i
For i = 10 To 35
a(i) = Chr(87 + i)
Next i
Randomize
For i = 0 To 9999
strLeft = Format(Int(Rnd * 301), "000")
strRight = ""
For j = 0 To 4
strRight = strRight & a(Int(Rnd * 36))
Next j
arr(i) = strLeft & " " & strRight
Next i
End Sub
Dim arr(9999) As String
Dim a(35) As String
For i = 0 To 9
a(i) = Chr(48 + i)
Next i
For i = 10 To 35
a(i) = Chr(87 + i)
Next i
Randomize
For i = 0 To 9999
strLeft = Format(Int(Rnd * 301), "000")
strRight = ""
For j = 0 To 4
strRight = strRight & a(Int(Rnd * 36))
Next j
arr(i) = strLeft & " " & strRight
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询