产生100个1000以内随机数并在Text中显示
Private Sub Form_Load()
Dim a(100) As Integer
Randomize Timer
For k = 1 To 100
a(k) = Int(Rnd() * 1000)
Text1 = Text1 & Str(a(k))
Next k
End Sub
Option Explicit
Private Sub Command1_Click()
Dim a(3) As Single
Dim i As Integer
Randomize
For i = 0 To 3
a(i) = Rnd()
Text1.Text = Text1.Text & a(i) & vbCrlf
Next
End Sub