学习笔记之随机数
x = random.getstate()
>>> print(x)
>>> random.randint(1,10)
6
>>> random.randint(1,10)
6
>>> random.randint(1,10)
10
>>> random.randint(1,10)
1
>>> random.randint(1,10)
4
>>> random.randint(1,10)
2
>>> random.randint(1,10)
5
>>> random.setstate(x)
>>> random.randint(1,10)
6
>>> random.randint(1,10)
6
>>> random.randint(1,10)
10
>>> random.randint(1,10)
1
>>> random.randint(1,10)
4
随机数的生成和状态再次重现
页:
[1]