stochastic-rs-core
Core traits, SIMD RNG, and seeding for stochastic-rs
The foundation crate. Everything else in the workspace draws its randomness from here.
What is in it
SimdRng— a xoshiro-based generator with SIMD bulk fills (fill_uniform_f64,fill_ziggurat, …). Implementsrand::RngCore, so it drops into anything expecting anRng.SeedExt— the workspace seeding contract. Two implementations:Unseeded(a fresh, globally unique stream per construction, zero overhead) andDeterministic::new(seed)(reproducible,AtomicU64-backed soderive()can fan out independent child streams from one source).SimdRngDual— an experimental two-engine variant behind thedual-stream-rngfeature. Roughly 5–11% faster on ziggurat-based bulk fills on Apple Silicon; its stream is not bit-compatible withSimdRng.
Usage
use ;
// Reproducible
let mut rng = from_seed;
let x = rng.next_f64;
// A seed source to hand to a distribution or process
let seed = new;
Seeding rule
The seed belongs to the constructor, not to an Rng you pass in later.
Distributions in this workspace own their stream; a fill_slice(rng, out)
call ignores the rng argument by design.
Part of stochastic-rs
This crate is one of the sub-crates of stochastic-rs. Most users should depend on the umbrella crate, which re-exports everything:
[]
= "2.6"
Depend on stochastic-rs-core directly only when you want this slice and nothing else.
- Documentation: stochastic.rust-dd.com
- API reference: docs.rs/stochastic-rs-core
License
MIT