random-tools 0.1.0
Seedable PRNGs (SplitMix64, xorshift64, PCG32) with shuffle, choose and unbiased ranges; non-cryptographic
Install
cargo add random-tools --registry rupm
In Ruststudio: Packages, search for random-tools, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.
Versions
- 0.1.0 2026-11-22
README
# random-tools
Seedable PRNGs (SplitMix64, xorshift64, PCG32) with shuffle, choose and unbiased ranges; non-cryptographic
Add it with `rupm add random-tools` (or `cargo add random-tools --registry rupm`).
NOT cryptographically secure. Use it for games, simulations, tests and shuffling, never for passwords, keys, tokens or anything security-critical. The seed from from_entropy() mixes the standard library's randomly keyed hasher with the clock; it is not a cryptographic entropy source.
```rust
use random_tools::{Pcg32, Rng};
let mut a = Pcg32::new(42, 54);
assert_eq!(a.next_u32(), 0xa15c_02b7); // reference value from the PCG paper demo
let mut rng = Pcg32::from_entropy();
let mut v = vec![1, 2, 3, 4, 5];
rng.shuffle(&mut v);
let pick = rng.choose(&v);
assert!(pick.is_some());
```