Dim n As Integer
Dim x As Single
Dim a As Integer, b As Integer
Dim i As Integer
n = Val(Text1)
For i = 1 To n
Randomize
x = Rnd
If x > 0.5 Then
a = a + 1
Else
b = b + 1
End If
Next i
Label3.Caption = a
Label4.Caption = b
End Sub
Private Sub Form_Load()
Text1.Text = ""
Label3.Caption = ""
Label4.Caption = ""
End Sub
![](http://d.hiphotos.baidu.com/zhidao/wh%3D600%2C800/sign=02287eb38a13632715b8ca35a1bf8cd4/0e2442a7d933c895c2b47a14d11373f083020092.jpg)