osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

on the prng behind random.random()


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?