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

后端 未结 3 1100
余生分开走
余生分开走 2021-02-14 20:38

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 21:05

    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.

提交回复
热议问题