prrng 0.4.0

psuedo-random number generation
Documentation
  • Coverage
  • 79.73%
    59 out of 74 items documented17 out of 19 items with examples
  • Size
  • Source code size: 73.97 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 13.96 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • wainggan/prrng
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wainggan

prrng

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.

rust version support

what is that?