Skip to main content

Module rand

Module rand 

Source
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::Read over a TryRng

Traits§

CryptoRng
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
SeedableRng
A random number generator that can be explicitly seeded.
TryCryptoRng
A marker trait over TryRng for securely unpredictable RNGs
TryRng
Base trait for random number generators and random data sources

Functions§

fill
Fill any type implementing Fill with 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 p of being true.
random_f32
A wrapper function around the random function 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 random function 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/denominator of being true.
rng
Access a fast, pre-initialized generator