on the prng behind random.random()

Robert Girault r at dev.null
Mon Nov 19 12:51:13 EST 2018


Looking at its source code, it seems the PRNG behind random.random() is
Mersenne Twister, but I'm not sure.  It also seems that random.random()
is using /dev/urandom.  Can someone help me to read that source code?

I'm talking about CPython, by the way.  I'm reading 

  https://github.com/python/cpython/blob/master/Lib/random.py

The initial comment clearly says it's Mersenne Twister, but the only
random() function there seems to call _urandom(), which I suppose is an
interface to /dev/urandom.

What am I missing here?



More information about the Python-list mailing list