-
尝试理解, Python下随机数的产生原理和算法
- 伪随机数:(pseudorandom number) 算法+指定的不确定因素 (种子seed). 一般计算机的随机数都是伪随机数,以一个真随机数(种子)作为初始条件,然后用一定的算法不停迭代产生随机数。
- 种子seed:一般种子可以根据当前的系统时间,这是完全随机的。
- random module中的method, 生成随机数的步骤:(指定一个seed) ---> (随机数产生算法) ---> 取到 [0,1) 范围内随机分布的随机数.
- To completely reset between runs, you will have to restart the kernel via the menu option (Run -> Restart Kernel) or via the keyboard (Ctrl with the period key).
- with random.seed() (without any arguments), you can reset the seed to use the system clock, when you are writing a program and would like to generate pseudorandom number later on in the code.
-
the random module