Expand description
Closed-form sampling transforms shared with the Python comparison harness.
Each function consumes raw output from any RngCore and applies a transform
that is mirrored exactly in compare/models/_feed.py. Driving both engines
from a SplitMix64 feed plus these transforms makes their per-draw samples
agree to floating-point tolerance.
use simu::rng::{sample, SplitMix64};
let mut feed = SplitMix64::new(42);
let u = sample::uniform01(&mut feed); // in [0, 1)
assert!((0.0..1.0).contains(&u));Functions§
- bernoulli
- Draw a Bernoulli trial that is
truewith probabilityp. - exponential
- Draw an exponential variate with the given
meanvia inverse-CDF. - normal
- Draw a normal variate via Box–Muller, consuming exactly two uniforms.
- uniform01
- Draw a uniform
f64in[0, 1)using the top 53 bits of au64.