万年历 诗书乐园
 
本站首页 音乐欣赏 古代书法 山人书法 ASP技术 会员中心 网址大全
狗年
栏目导航 首页>>ASP技术>>ASP资料
首页 作者 管理员  发表时间 2012-4-15 0:27:12 总浏览次数 1340 回到上页
 
[转帖]生成一个不重复的随即数字
 
生成一个不重复的随即数字

 
Sub CalCaPiao()
Dim strCaiPiaoNoArr() As String
Dim strSQL As String
Dim strCaiPiaoNo As String
strCaiPiaoNo = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33"
Dim StrTempArr(7) As String
Dim strZhongJiangArr(7) As String
strCaiPiaoNoArr = Split(strCaiPiaoNo, ",")
Dim intRand As Integer
Dim i As Integer
Dim j As Integer
i = 0
Dim find As Boolean
Do While True
find = False
Randomize
intRand = Int((33 * Rnd) + 1)
For j = 0 To i - 1
If StrTempArr(j) = CStr(intRand) Then
find = True
End If
Next
If Not find Then
StrTempArr(j) = CStr(intRand)
strZhongJiangArr(i) = CStr(intRand)
'Text1(i) = strZhongJiangArr(i)
i = i + 1
If i = 7 Then
Exit Do
End If
End If
Loop
End Sub

回到上页

 
关于我们 联系我们
Copyright © 诗书乐园 All Rights Reserved
地址 广东佛山  Email pcmusic1000@163.com
ICP备案序号:粤ICP备10230805号-1