Seedable, platform-identical PRNG for deterministic game simulations.
Produces bit-identical output on x86, ARM, and WASM for the same seed. Designed for lockstep multiplayer, deterministic replays, and save/load reproducibility.
⚠️ Early development — API is unstable but core generator works.
GameRng— xoshiro256** with version-pinned, forever-stable output- Range sampling with zero modulo bias (Lemire's method)
- Damage spread for RTS combat:
spread(base, variance) - Deterministic Fisher-Yates shuffle
#![no_std]compatible
- Weighted selection from slices
- Weighted index selection for probability tables
- Serde serialization for save/load
use deterministic_rng::GameRng;
let mut rng = GameRng::from_seed(42);
// Same seed always produces same values — on every platform.
let damage = rng.spread(100, 15); // 85..=115
let crit = rng.next_bounded(100) < 5; // 5% chanceDesign rationale is in the Iron Curtain Design Documentation:
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributions require a Developer Certificate of Origin (DCO) — add Signed-off-by
to your commit messages (git commit -s).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.