import random
...

def
main(): a = random.Random() a.seed(1) print a.random()

这样就可以通过种子取得固定随机值了

网上很多只写了一半,导致random.seed(..)调用总报错。。

相关文章: