prrng 0.3.0

psuedo-random number generation
Documentation
  • Coverage
  • 67.65%
    69 out of 102 items documented17 out of 51 items with examples
  • Size
  • Source code size: 68.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 14.29 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s 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 very esoteric ones like a recreation of the infamous RANDU function, or even the rng used in BBC Elite. all this, while being completely no_std.

everything here is best effort.