Skip to content

A zero-dependency, no_std-compatible, easily extendable library intended for fast random number generation.

Notifications You must be signed in to change notification settings

inspier/picorand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

A zero-dependency, no_std-compatible, easily extendable library intended for fast random number generation.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages