turborand 0.3.1

A simple and fast random number generator
Documentation

turborand

CI License Cargo Documentation

A fast random number generator.

turborand's internal implementation uses Wyrand, a simple and fast generator but not cryptographically secure.

Examples

use turborand::*;

let rand = rng!();

if rand.bool() {
    println!("Success! :D");
} else {
    println!("Failure... :(");
}

Sample a value from a list:

use turborand::*;

let rand = rng!();

let values = [1, 2, 3, 4, 5];

let value = rand.sample(&values);

Generate a vector with random values:

use turborand::*;
use std::iter::repeat_with;

let rand = rng!();

let values: Vec<_> = repeat_with(|| rand.f32()).take(10).collect();

License

Licensed under either of

at your option.