SRandom
设置随机数种子.
SRandom ( Seed )
参数
Seed
|
随机数的种子值. 取值范围: -2^31 到 2^31-1
|
返回值
None.
备注
每次运行使用本函数的脚本, 随机数序列将被重复. 例如, 您可以测试脚本的速度, 随机数将不会影响测试结果
每次调用本函数之后, 随机数字生成器启动一个新的序列. 使用 SRandom(@SEC) 将生成不同的随机序列.
相关
Random
函数示例
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Sets the seed to the number 12.
SRandom(12)
; Assign a Local variable the random number based on the above seed.
Local $iRandom1 = Random()
; Note: You will get the same result each time as the seed is constant.
; Display the result.
MsgBox($MB_SYSTEMMODAL, "", $iRandom1)
EndFunc ;==>Example
----------------------------------------
|