random.randint shows different output in Python 2.x and Python 3.x with same seed

后端 未结 3 1347
旧时难觅i
旧时难觅i 2021-02-14 20:22

I am porting the application from python 2 to python 3 and encountered the following problem: random.randint returns different result according to used Python versi

3条回答
  •  一个人的身影
    2021-02-14 20:47

    You can specify which version to use for the seed: random.seed(1, version=1). However, as stated by Sparky05, you are probably better off using numpy.random instead.

提交回复
热议问题