picorand

Crates.iopicorand
lib.rspicorand
version0.1.2
sourcesrc
created_at2020-12-21 06:54:33.686889
updated_at2023-02-07 04:55:24.617474
descriptionA zero-dependency, no_std-compatible, easily extendable library intended for fast random number generation using the WyRand PRNG with a pico-sized footprint.
homepage
repositoryhttps://github.com/inspier/picorand
max_upload_size
id325121
size8,717
(inspier)

documentation

https://docs.rs/picorand

README

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);
}
Commit count: 13

cargo fmt