十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
与VB6里边完全一样:
创新互联于2013年创立,是专业互联网技术服务公司,拥有项目成都网站制作、成都网站设计网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元永新做网站,已为上家服务,为永新各地企业和个人服务,联系电话:028-86922220
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Randomize()
MsgBox(Rnd() * 100)
End Sub
Private Sub Command1_Click()
Dim num(6) As Integer
Dim i As Integer, j As Integer
Dim tmp As Integer
Randomize '防止每次生出随机数一样
For i = 0 To 5
num(i) = Int(Rnd * 53) + 1
Next
PrintNum "新生成的6个随机数为:", num()
For i = 0 To 5
For j = 0 To 5
If num(j) num(j + 1) Then
tmp = num(j)
num(j) = num(j + 1)
num(j + 1) = tmp
End If
Next
Next
PrintNum "排序后的6个随机数为:", num()
End Sub
'项目:VB中产生在一定正整数范围内的不重复的随机数'作者:qq15495835Private Sub Command1_Click() Max = 100 '随机数上限值 Min = 1 '随机数下限值 Amount = 10 '产生号码数量(数量值应小于随机数上限值-随机数下限值)否则会产生死循环 ReDim a(Amount) Randomize For i = 0 To Amount a(i) = Int((Max - Min + 1) * Rnd + Min) For j = 0 To i If i j And a(i) = a(j) Then i = i - 1 Next Next Text1 = Join(a, vbCrLf)End Sub'请采纳参考!谢谢!