Expand description
Items related to randomness and random number generators. Also provides some high-level helper functions.
Helper functions include random_f32(), random_f64() and random_range(min, max).
Modules§
- rand
- Utilities for random number generation
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
Functions§
- fill
- Fill any type implementing
Fillwith random data - make_
rng - Construct and seed an RNG
- random
- Generate a random value using the thread-local random number generator.
- random_
ascii - Generates and returns a random ascii character.
- random_
bool - Return a bool with a probability
pof being true. - random_
f32 - A wrapper function around the
randomfunction that avoids the need for specifying a type in the case that it cannot be inferred. The primary purpose for this is to simplify the random API for new rust users. - random_
f64 - A wrapper function around the
randomfunction that avoids the need for specifying a type in the case that it cannot be inferred. The primary purpose for this is to simplify the random API for new rust users. - random_
iter - Return an iterator over
random()variates - random_
range - A function for generating a random value within the given range.
- random_
ratio - Return a bool with a probability of
numerator/denominatorof being true. - rng
- Access a fast, pre-initialized generator