|
Private Sub Command5_Click()
Dim rn() As String
rn = Split(fncRndNum(1, 100, 100), ",")
Text1 = Join(rn)
End Sub
Private Function fncRndNum(llMinNum As Long, llMaxNum As Long, Num As Long) As String
Dim lsTemp As String
Dim lsNum As String
Do While Num > 0
lsNum = Int(Rnd * (llMaxNum - llMinNum + 1)) + llMinNum
If InStr(lsTemp, lsNum) = 0 Then
lsTemp = IIf(lsTemp = "", "", lsTemp & ",") & lsNum
Num = Num - 1
End If
Loop
fncRndNum = lsTemp
End Function
剩下9个数的时候一直死循环,但是改为101到200或其它高于101以上的数却没有问题,怪怪的,偶看不出什么问题,各位大侠分析析看看。 |
|