Is Pythons random.randint statistically random?

前端 未结 6 2121
悲哀的现实
悲哀的现实 2020-12-16 06:00

So I\'m testing an calculating the probabilities of certain dice rolls, for a game. The base case if that rolling one 10sided die.

I did a million samples of this,

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 06:00

    Yes, it is statistically random for all practical purposes. The random variation you saw is perfectly normal. In fact it would be a poor rng if it didn't have variation like that.

    Since the period of the prng is 2**19937-1, you would need to generate more numbers than there are atoms in the universe before you see a nonrandom distribution. Note that if you generate 623 dimensional vectors, it becomes non random much sooner.

提交回复
热议问题