怎么用vb随机生成1~10000的10000个数,在按1~1000 1001~2000 2001~3000 9001~10000分类?

问题描述:

怎么用vb随机生成1~10000的10000个数,在按1~1000 1001~2000 2001~3000 9001~10000分类?
怎么用vb随机生成1~10000的10000个数,在按1~1000 1001~2000 2001~3000.9001~10000分类?
这样写
Private Sub Command1_Click()
Cls
Dim a(100)
Dim n(10)
Dim s(10)
For i = 1 To 100
a(i) = Int(Rnd() * 100)
k = Int(a(i) / 10) + 1
n(k) = n(k) + 1
s(k) = s(k) + a(i)
Next
For i = 1 To 10
Print n(i),
Next
Print
For i = 1 To 10
Print s(i),
Next
Print
For i = 1 To 10
Print s(i) / n(k),
Next
Print
Print
For i = 1 To 100
Print a(i),
If i Mod 10 = 0 Then
Print
End If
Next
Print
Print k,s(k),n(k)
End Sub
我刚知道

'在窗体上画两个列表框(ListBox),一个按钮(CommandButton)
'粘贴以下代码
'单击List1里的范围,在List2里列出该分类的所有数据
Dim Num(1 To 10000) As Integer
Private Sub Command1_Click()
List1.Clear
List2.Clear
On Error Resume Next
For i = 1 To 10000
Randomize
Num(i) = Int(10000 * Rnd)
Next
For i = 0 To 9
List1.AddItem i * 1000 + 1 & " & (i + 1) * 1000
Next
For i = 1 To 10000
If Num(i) >= 1 And Num(i) = List1.ListIndex * 1000 + 1 And Num(i)