管理员
精华
|
战斗力 鹅
|
回帖 0
注册时间 2002-1-3
|
源代码我贴这里,AHK写的,用了两次随机函数外加取当前时间做加法乘法再算余数计算出来的随机数
不过我懒得去掉已经获得的结果,所以有可能生成两个一样的数字,如果这样的话结果我先贴出来作废,再运行一次
- InputBox, UserInput, Random Number, Please enter the maximum number., , 320, 240
- if ErrorLevel
- MsgBox, CANCEL was pressed.
- else
- Random, rand, 1, %UserInput%
- FormatTime, timestring1,, ms
- sleep 1500
- FormatTime, timestring2,, s
- timerand := timestring1 * (timestring2 + rand)
- Random, rand, 1, %UserInput%
- timerand := timerand + rand
- result1 := UserInput - (timerand - (timerand//UserInput) * UserInput)
- Random, rand, 1, %UserInput%
- FormatTime, timestring1,, ms
- sleep 1500
- FormatTime, timestring2,, s
- timerand := timestring1 * (timestring2 + rand)
- Random, rand, 1, %UserInput%
- timerand := timerand + rand
- result2 := UserInput - (timerand - (timerand//UserInput) * UserInput)
-
- Random, rand, 1, %UserInput%
- FormatTime, timestring1,, ms
- sleep 1500
- FormatTime, timestring2,, s
- timerand := timestring1 * (timestring2 + rand)
- Random, rand, 1, %UserInput%
- timerand := timerand + rand
- result3 := UserInput - (timerand - (timerand//UserInput) * UserInput)
-
- MsgBox, Lucky Draw`n1st is %result1%`n2nd is %result2%`n3rd is %result3%
复制代码 |
|