怎么用vb.net随机产生5个不同的数,范围1-33,求帮忙改一下

PrivateSubForm1_click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBa... Private Sub Form1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click
TextBox1.Text = ""
Dim rnd As New Random()
Dim b(4) As Byte
rnd.NextBytes(b)
Console.WriteLine("the random bytes are :")
Dim i As Integer
For i = 0 To 4
Console.Write(i)
Console.Write(":")
Console.WriteLine(b(i))
Next i
For j = 0 To 4
TextBox1.Text &= b(j) & " " & vbCrLf
Next
End Sub
展开
 我来答
折柳成萌
高粉答主

2018-01-06 · 繁杂信息太多,你要学会辨别
知道顶级答主
回答量:4.4万
采纳率:96%
帮助的人:5980万
展开全部
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
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式