以下是引用yjyjipc在2007-8-21 16:22:19的发言:

 不好意思,看不懂...也试不出来..
不好意思,看不懂...也试不出来..
前面那个算法是用数组保存已经产生的数的
 不好意思,看不懂...也试不出来..
不好意思,看不懂...也试不出来..这个算法思路是用字符串产生已经产生的数,可以用Instr方便地判断是否已生成
== 好像有点问题 我去修正一下

 不好意思,看不懂...也试不出来..
不好意思,看不懂...也试不出来.. 2007-08-21 18:17
	    2007-08-21 18:17
  
 2007-08-21 18:26
	    2007-08-21 18:26
   2007-08-21 18:28
	    2007-08-21 18:28
  Private Sub Command1_Click()
    
    Dim t1, t2 As Integer
    Dim t3 As String
    Dim t(9) As String
    For t1 = 0 To 9
        Randomize
         t2 = Int((100 - 1 + 1) * Rnd + 1)
         List1.AddItem abc(CStr(t2), t)
    Next t1
End Sub
Private Function abc(a As String, b() As String) As String
    Dim i As Integer
    Dim bol As Boolean
    bol = False
    For i = LBound(b) To UBound(b)
        If b(i) = a Then
            bol = True
            Exit For
        End If
    Next
    If bol = False Then
        abc = a
    Else
        Randomize
        abc = abc(CStr(Int((100 - 1 + 1) * Rnd + 1)), b)
    End If
End Function
 2007-08-21 20:04
	    2007-08-21 20:04