7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Timer1_Timer()
Label2.Alignment = 2
Label3.Alignment = 2
Label4.Alignment = 2
If ten_flag = False Then
Do
num = Int(660 * Rnd + 1)
num4 = num
num1 = num4 Mod 10 '个位
num4 = Int(num4 / 10)
num2 = num4 Mod 10 '十位
num4 = Int(num4 / 10)
num3 = num4 Mod 10 '百位
Loop While tempnum(num) = 1
tempnum(num) = 1
Label4.Caption = num1
Label3.Caption = num2
Label2.Caption = num3
str_temp = Label2.Caption + Label3.Caption + Label4.Caption
Else
str_temp = ""
For ten_i = 1 To 10
Do
num = Int(660 * Rnd + 1)
num4 = num
num1 = num4 Mod 10 '个位
num4 = Int(num4 / 10)
num2 = num4 Mod 10 '十位
num4 = Int(num4 / 10)
num3 = num4 Mod 10 '百位
Loop While tempnum(num) = 1
tempnum(num) = 1
Label4.Caption = num1
Label3.Caption = num2
Label2.Caption = num3
str_temp = str_temp + Label2.Caption + Label3.Caption + Label4.Caption + " "
Next ten_i
End If
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>抓奖</title>
</head>
<body>
<p><a href="#" id="idButton">开始</a></p>
<p id="idOutText">列表</p>
</body>
<script language="VBScript">
Dim priNumList()
Dim priOutList()
Dim priWorking
Dim priTimer
tNumCount = 660
tOutCount = 10
ReDim priNumList(tNumCount - 1)
ReDim priOutList(tOutCount - 1)
For tIndex = 0 To tNumCount - 1
priNumList(tIndex) = tIndex
Next
idButton.innerText = "开始"
priWorking = False
Sub idButton_onClick()
priWorking = Not priWorking
idButton.innerText = Split("开始,停止", ",")(priWorking And 1)
If priWorking Then Web_TimeLoop
End Sub
Sub ListSwap(pList(), pIndex)
tDesIndex = Int(Rnd * (UBound(pList) - pIndex)) + pIndex
ValueSwap pList(pIndex), pList(tDesIndex)
End Sub
Sub ValueSwap(pA, pB)
tT = pA: pA = pB: pB = tT
End Sub
Sub Web_TimeLoop()
For tIndex = 0 To 9
ListSwap priNumList, tIndex
priOutList(tIndex) = tIndex + 1 & " " & priNumList(tIndex)
Next
idOutText.innerText = Join(priOutList, vbCrLf)
If priWorking Then priTimer = window.setTimeout("Web_TimeLoop", 10)
End Sub
</script>
</html>
Option Explicit
Private priNumList() As Long
Private priOutList() As String
Private Sub Form_Load()
'需要设置Text1.MultiLine = True
Timer1.Enabled = False
Dim tIndex As Long
Dim tNumCount As Long
Dim tOutCount As Long
tNumCount = 660 '可以把这个数字设置成10来测试它是否准确。
tOutCount = 10
ReDim priNumList(tNumCount - 1)
ReDim priOutList(tOutCount - 1)
For tIndex = 0 To tNumCount - 1
priNumList(tIndex) = tIndex
Next
Command1.Caption = "开始"
Timer1.Interval = 10
End Sub
Private Sub Command1_Click()
'开始
Timer1.Enabled = Not Timer1.Enabled
Command1.Caption = Split("开始,停止", ",")(Timer1.Enabled And 1)
End Sub
Private Sub ListSwap(ByRef pList() As Long, ByRef pIndex As Long)
'将pIndex指定的元素与后面的随机元素交换。
Dim tDesIndex As Long
tDesIndex = Int(Rnd * (UBound(pList()) - pIndex)) + pIndex
ValueSwap pList(pIndex), pList(tDesIndex)
End Sub
Private Sub ValueSwap(ByRef pA As Long, ByRef pB As Long)
'交换两个Long的值。
Dim tT As Long
tT = pA: pA = pB: pB = tT
End Sub
Private Sub Timer1_Timer()
Dim tIndex As Long
For tIndex = 0 To 9
ListSwap priNumList(), tIndex
priOutList(tIndex) = Format(tIndex + 1, "00") & " " & Format(priNumList(tIndex), "000")
Next
Text1.Text = Join(priOutList, vbCrLf)
End Sub
Private priNumList() As Long
Private priNumList_Index As Long
Private priOutList() As String
Private Sub Form_Load()
'需要设置Text1.MultiLine = True
Timer1.Enabled = False
Dim tNumCount As Long
Dim tOutCount As Long
tNumCount = 660 '可以把这个数字设置成10来测试它是否准确。
tOutCount = 10
ReDim priNumList(tNumCount - 1)
ReDim priOutList(tOutCount - 1)
For tIndex = 0 To tNumCount - 1
priNumList(tIndex) = tIndex
Next
Command1.Caption = "开始"
Command2.Caption = "停止"
Command3.Caption = "抓取"
Timer1.Interval = 10
End Sub
Private Sub Command1_Click()
'开始
Timer1.Enabled = True
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
'停止
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub
Private Sub Command3_Click()
'抓取
Timer1.Enabled = False
priNumList_Index = priNumList_Index + ((priNumList_Index < 9) And 1)
Timer1.Enabled = True
End Sub
Private Sub ListSwap(ByRef pList() As Long, ByRef pIndex As Long)
'将pIndex指定的元素与后面的随机元素交换。
Dim tDesIndex As Long
tDesIndex = Int(Rnd * (UBound(pList()) - pIndex)) + pIndex
ValueSwap pList(pIndex), pList(tDesIndex)
End Sub
Private Sub ValueSwap(ByRef pA As Long, ByRef pB As Long)
'交换两个Long的值。
Dim tT As Long
tT = pA: pA = pB: pB = tT
End Sub
Private Sub Timer1_Timer()
ListSwap priNumList(), priNumList_Index
priOutList(priNumList_Index) = Format(priNumList_Index + 1, "00") & " " & Format(priNumList(priNumList_Index), "000")
Text1.Text = Join(priOutList, vbCrLf)
End Sub