mt19937predictor module¶
-
mt19937predictor.LOWER_MASK= 2147483647¶
-
mt19937predictor.M= 397¶
-
mt19937predictor.MATRIX_A= 2567483615¶
-
class
mt19937predictor.MT19937Predictor[source]¶ Bases:
random.RandomUsage:
>>> import random >>> from mt19937predictor import MT19937Predictor >>> predictor = MT19937Predictor() >>> for _ in range(624): ... x = random.getrandbits(32) ... predictor.setrandbits(x, 32) >>> random.getrandbits(32) == predictor.getrandbits(32) True >>> random.random() == predictor.random() True >>> a = list(range(100)) >>> b = list(range(100)) >>> random.shuffle(a) >>> predictor.shuffle(b) >>> a == b True
-
gauss(*args)[source]¶ Raises: NotImplementedError
-
getrandbits(bits)[source]¶ The interface for
random.Random.getrandbits()in Python’s Standard Library
-
getstate(*args)[source]¶ Raises: NotImplementedError
-
seed(*args)[source]¶ Raises: NotImplementedError
-
setrand_int32(y)[source]¶ Feceive the target PRNG’s outputs and reconstruct the inner state. when 624 consecutive DOWRDs is given, the inner state is uniquely determined.
-
setrandbits(y, bits)[source]¶ The interface for
random.Random.getrandbits()in Python’s Standard Library
-
setstate(*args)[source]¶ Raises: NotImplementedError
-
-
mt19937predictor.N= 624¶ 624 values (of 32bit) is just enough to reconstruct the internal state
-
mt19937predictor.UPPER_MASK= 2147483648¶