Skip to content

iron-curtain-engine/deterministic-rng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deterministic-rng

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.

Status

⚠️ Early development — API is unstable but core generator works.

Features

  • 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

Planned

  • Weighted selection from slices
  • Weighted index selection for probability tables
  • Serde serialization for save/load

Usage

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% chance

Design Documents

Design rationale is in the Iron Curtain Design Documentation:

License

Licensed under either of:

at your option.

Contributing

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.

About

Seedable platform-identical PRNG (xoshiro256**) for deterministic game simulation. MIT/Apache-2.0.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages