Exact RNG

NumPy-exact random streams.

Duckietown.NumpyMT19937 — Type
NumpyMT19937(seed) <: Random.AbstractRNG

np.random.RandomState(seed) for integer seeds in [0, 2^32-1] (the legacy init_genrand path; larger seeds use init_by_array, which no reference config needs). rand(rng) produces the same Float64 stream as RandomState.random_sample().

source
Duckietown.NumpyPCG64 — Type
NumpyPCG64(seed) / NumpyPCG64(ss::NumpySeedSequence)

np.random.PCG64(SeedSequence(seed)): seeded from generate_state(4, uint64) as (hi, lo) pairs for initstate/initseq (pcg64_srandom_r). pcg64_next_uint64 / np_random_double / np_uniform / np_integers mirror the bit generator and the Generator methods called by the simulator reset path.

source
Duckietown.NumpySeedSequence — Type
NumpySeedSequence(entropy)

np.random.SeedSequence(entropy) with the default pool size 4 and no spawn key: the entropy integer is split into little-endian 32-bit words, hashed and mixed into the pool; seedseq_generate_state reproduces generate_state.

source
Duckietown.mt_state — Method
mt_state(r) -> (Vector{UInt32}, Int)

The 624-word key and position, comparable with RandomState.get_state().

source
Duckietown.np_integers — Method
np_integers(g, low, high) -> Int

Generator.integers(low, high) (default endpoint=false, int64 dtype): random_bounded_uint64_fill with use_masked=false — for ranges that fit in 32 bits (every reference call site) this is Lemire's rejection on the BUFFERED 32-bit source (bounded_lemire_uint32 over pcg64_next32); larger ranges use the 64-bit Lemire.

source
Duckietown.np_normal — Method
np_normal(g, loc, scale) -> Float64

Generator.normal(loc, scale): loc + scale * standard_normal().

source
Duckietown.np_standard_normal — Method
np_standard_normal(g) -> Float64

random_standard_normal (numpy ziggurat, verbatim incl. the GH-13361 log(1 - u) tail form). The fast path (~99.3%) is pure integer × table and bit-exact; the wedge/tail paths go through libm log/exp, subject to the documented ≤1-ULP cross-libm caveat at astronomically rare rejection boundaries.

source
Duckietown.pcg64_next_uint32 — Method
pcg64_next_uint32(g) -> UInt32

pcg64_next32: LOW half of a fresh uint64 first; the HIGH half is buffered in the generator state and returned by the next call.

source
Duckietown.random_sample — Method
random_sample(r) -> Float64

RandomState.random_sample(): 53-bit double from two tempered words, ((a >> 5) * 67108864 + (b >> 6)) / 9007199254740992.

source
Duckietown.seedseq_generate_state — Method
seedseq_generate_state(ss, n) -> Vector{UInt64}

SeedSequence.generate_state(n, np.uint64): 2n hashed uint32 words from the cycled pool, paired little-endian (low word first).

source