Expand description
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.
Re-exports§
pub use rand_core;
Modules§
- distr
- Generating random samples from probability distributions
- prelude
- Convenience re-export of common members
- rngs
- Random number generators and adapters
- seq
- Sequence-related functionality
Structs§
- RngReader
- Adapter to support
std::io::Readover aTryRng
Traits§
- Crypto
Rng - A marker trait for securely unpredictable infallible RNGs
- Fill
- Support filling a slice with random data
- Rng
- Trait for infallible random number generators
- RngExt
- User-level interface for RNGs
- Seedable
Rng - A random number generator that can be explicitly seeded.
- TryCrypto
Rng - A marker trait over
TryRngfor securely unpredictable RNGs - TryRng
- Base trait for random number generators and random data sources