Krikri::PyRandom
Constants
LOWER_MASK = 2147483647_u32
M = 397
MATRIX_A = 2567483615_u32
N = 624
UPPER_MASK = 2147483648_u32
Constructors
Class methods
Splits a big-endian byte payload into 32-bit words, lowest word
first (the layout _PyLong_AsByteArray produces for the integer
int.from_bytes(payload, 'big')), trimming leading zero words the
way _PyLong_NumBits-derived keyused does. Byte indices past the
start of the payload contribute zero.
An int seed is used as-is; its 32-bit words go into init_by_array lowest first (little-endian), leading zero words dropped.
Instance methods
random.Random.choice(seq) - Python 3.11+ form (index via _randbelow).
_randommodule.c's getrandbits: words = (k - 1) / 32 + 1 words
assembled little-endian, with the final word's low bits dropped
(r >>= (32 - k)) when the bit count isn't a multiple of 32.
Supports up to 64 bits, far beyond any randrange/choice use here.