’获得一定长度的随机数代码 
’参数max最大长度 
’参数min最小长度 
Function getRanDom(max,min) 
    Dim times, i, j 
    Dim ttNumber 
    times = 2 
    ttNumber = max + min - 1 
    Dim tAry() 
    ReDim tAry(ttNumber) 
    For i = 0 To ttNumber 
        tAry(i) = min + i 
    Next 
    For j = 0 To times - 1 
        i = ttNumber - 1 
        While i > 0 
              Dim temp,randomNum 
              temp = 0 
              randomNum = CInt(TtGetRandom(0, max * 3, i) Mod i)
              
              temp = tAry(i) 
              tAry(i) = tAry(randomNum) 
              tAry(randomNum) = temp 
              i = i - 1 
       Wend 
   Next 
   getRanDom = tAry 
End Function 
Function TtGetRandom(max,min,chaosSeed) 
    Randomize chaosSeed * Timer() 
    TtGetRandom = Rnd * chaosSeed 
End Function
摘自我的网站:http://www.
[[it] 本帖最后由 yms123 于 2008-9-11 09:52 编辑 [/it]]