Skip to main content

Module rng

Module rng 

Source
Expand description

Pluggable randomness sources and a portable, deterministic feed.

By default a SimEnv draws from rand’s StdRng. For cross-language reproducibility (e.g. the SimPy comparison harness) the env can instead be driven from any RandomSource via SimEnv::with_source.

This module ships SplitMix64, a tiny portable PRNG whose output stream is defined purely by integer arithmetic, so it can be re-implemented byte-for-byte in another language (see compare/models/_feed.py). Combined with the closed-form transforms in sample, two engines seeded with the same value draw the same numbers and turn them into the same samples.

The two layers compose: every sample function takes any RngCore, so it works over StdRng or a SplitMix64 feed alike.

Modules§

sample
Closed-form sampling transforms shared with the Python comparison harness.

Structs§

SplitMix64
A portable, deterministic PRNG (SplitMix64).

Traits§

RandomSource
A pluggable source of randomness for a SimEnv.