picorand 0.1.2

A zero-dependency, no_std-compatible, easily extendable library intended for fast random number generation using the WyRand PRNG with a pico-sized footprint.
Documentation
  • Coverage
  • 92.31%
    12 out of 13 items documented1 out of 10 items with examples
  • Size
  • Source code size: 8.71 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 237.45 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • inspier/picorand
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • inspier

Current Crates.io Version docs-rs

picorand

A zero-dependency, no_std-compatible, easily extendable library intended for fast random number generation using the WyRand PRNG with a pico-sized footprint.

To add to your Cargo.toml:

picorand = "0.1.2"

Example

use picorand::{PicoRandGenerate, WyRand, RNG};

fn main() {
    let mut rng = RNG::<WyRand, u16>::new(0xDEADBEEF);

    // Generate in implicit range
    let mut generated = rng.generate();
    assert!(generated >= u16::MIN || generated < u16::MAX);

    // Generate in explicit range
    generated = rng.generate_range(0xC0, 0xDE);
    assert!(generated >= 0xC0 || generated < 0xDE);
}