Reputation: 4764
import random
import numpy.random
What is the algorithm for random
and numpy.random
. Usually Mersenne Twister is the default generator for matlab, and there are choice to choose which generator to use. What about python, is there a choice for random generator?
Upvotes: 4
Views: 1198
Reputation: 36739
Both cpython random
and numpy.random
use Mersenne Twister.
Both cpython random
and numpy.random
use /dev/(u)random
on UNIX and CryptGenRandom
on Windows for entropy.
Cpython allows to use Wichman Hill as an alternative PRNG, numpy does not (however you can use random.WichmanHill
to fill a previously allocated array).
Upvotes: 4