Dim m(1 To 20) As Integer
Dim i,j,cnt As Integer
Dim isHasSame As Boolean
For i = 1 To 20
'生成100以内的两位正整数
m(i) = Int(Rnd() * 90) + 10
Debug.Print i,m(i)
Next
cnt = 1 '不相同数据的个数
For i = 2 To 20
'判断当前的数据和以前的数据是否相同
isHasSame = False
For j = 1 To i - 1
If m(i) = m(j) Then
isHasSame = True
Exit For
End If
Next
If Not isHasSame Then
cnt = cnt + 1
End If
Next
MsgBox cnt