How to use VB to generate 10000 numbers of 1 ~ 10000 randomly, and classify them according to 1 ~ 1000, 1001 ~ 2000, 2001 ~ 3000, 9001 ~ 10000? How to use VB to generate 10000 numbers from 1 to 10000 randomly, and classify them according to 1 ~ 1000, 1001 ~ 2000, 2001 ~ 3000.9001 ~ 10000? Write like this 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 I just found out

How to use VB to generate 10000 numbers of 1 ~ 10000 randomly, and classify them according to 1 ~ 1000, 1001 ~ 2000, 2001 ~ 3000, 9001 ~ 10000? How to use VB to generate 10000 numbers from 1 to 10000 randomly, and classify them according to 1 ~ 1000, 1001 ~ 2000, 2001 ~ 3000.9001 ~ 10000? Write like this 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 I just found out

'draw two list boxes and a command button on the form
'paste the following code
'click the range in LIST1 to list all the data in 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)