Crate rand

Random-number generators and samplers

Quick Start

// rand::random() supports many common types:
println!("Uniform i8 sample: {}", match rand::random() {
    0i8 => "zero",
    i if i > 0 => "positive",
    _ => "negative",
});

// Ranged sampling:
use std::f32::consts::PI;
println!("Angle: {} degrees", rand::random_range(-PI..PI));

See also The Book: Quick Start.

Modules

Structs

Traits

Functions