Python random.random - chance to ride 0

As described in the documentation , random.random will "return the next random floating-point number in the range [0.0, 1.0]"

So what is the likelihood that it will return 0?

+4
source share
1 answer

According to the documentation he

It produces 53 bit precision

And the Mersenne Twister on which it is based has a huge space of states, many times larger than that. He also regularly passes statistical tests with bit independence (in programs designed to identify patterns in RNG output). The distribution is essentially uniform with the same probability that any bit will be 0 or 1.

0.0 1 2 ^ 53 ( )

+9

Source: https://habr.com/ru/post/1654843/


All Articles