我编了一个程序:Dim flag As Integer
Dim m(1 To 100) As Integer
Dim i As Integer
Dim p As Integer
Function f(i) As Integer
For p = 1 To i - 1
If m(i) = m(p) Then m(i) = (Int(Rnd() * c) + b): flag = 1
If m(i) <> m(p) Then flag = 0
Next p
If flag = 0 Then Print (m(i))
If flag = 1 Then f (i)
End Function
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim j As Integer
Randomize
a = InputBox("您想产生几个随机数呢?")
b = InputBox("随机数范围的起点是多少呢?(能取到)")
c = InputBox("随机数范围的终点是多少呢?(能取到)")
For i = 1 To a
flag = 0
m(i) = (Int(Rnd() * c) + b)
f (i)
Next i
End Sub
结果随机时即使规模较小,也会出现溢出提示,而且随机也不对(比如最小为5时会出现0),求高手指教或给出相似程序