| Crates.io | prrng |
| lib.rs | prrng |
| version | 0.4.0 |
| created_at | 2025-12-12 10:46:34.375624+00 |
| updated_at | 2025-12-27 01:17:00.48316+00 |
| description | psuedo-random number generation |
| homepage | |
| repository | https://github.com/wainggan/prrng.git |
| max_upload_size | |
| id | 1981347 |
| size | 74,442 |
a collection of psuedo-random number generators.
this crate provides a few prng algorithms, easily composable with each other via the [Random] trait.
use prrng::XorShift32;
fn main() {
let mut rng = XorShift32::new(1);
assert_eq!(rng.get(), 270369u32);
assert_eq!(rng.get(), 67634689u32);
use prrng::Random;
let mut iter = rng.random_iter();
assert_eq!(iter.next(), Some(0.7912035671411848));
assert_eq!(iter.next(), Some(0.5683147178403836));
assert_eq!(rng.random::<u64>(), 2716289712455752882);
assert_eq!(rng.random::<(u8, bool)>(), (37, false));
}
prrng is for fun, and mainly intended to have minimal and extremely simple implementations of various rng algorithms, including popular ones like some xorshift variants or ChaCha, and including esoteric ones like a recreation of the infamous RANDU function, or even the rng used in BBC Elite. all while being completely no_std, mostly const fn, and dependency-free.
everything here is best effort.
what is that?