rand()
从区间[0, 1)中均匀采样的随机数。
set a [expr rand()]
srand(arg)
arg必须是整数,用于重置随机数生成器的种子。返回该种子的第一个随机数。每个解释器都有自己的种子。rand()和srand()函数在加密上不安全,不能用于生成一次性密码或会话密钥。对于蒙特卡罗模拟的使用,它们也可能还不够强大。
The arg, which must be an integer, is used to reset the seed for the random number generator. Returns the first random number from that seed. Each interpreter has its own seed.
The rand() and srand() functions are not cryptographically secure, and must not be used to generate one-time passwords or session keys. They are also probably not strong enough for Monte-Carlo simulation usage.
expr srand(123) set a [expr rand()]
参考资料: