pub trait Rng: RngCore {
// Provided methods
fn random<T>(&mut self) -> T
where StandardUniform: Distribution<T> { ... }
fn random_iter<T>(&mut self) -> Iter<StandardUniform, &mut Self, T> ⓘ
where Self: Sized,
StandardUniform: Distribution<T> { ... }
fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform,
R: SampleRange<T> { ... }
fn random_bool(&mut self, p: f64) -> bool { ... }
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool { ... }
fn sample<T, D: Distribution<T>>(&mut self, distr: D) -> T { ... }
fn sample_iter<T, D>(&mut self, distr: D) -> Iter<D, &mut Self, T> ⓘ
where D: Distribution<T>,
Self: Sized { ... }
fn fill<T: Fill + ?Sized>(&mut self, dest: &mut T) { ... }
fn map<T, S, F>(&mut self, func: F) -> Map<StandardUniform, F, T, S>
where StandardUniform: Distribution<T>,
F: Fn(T) -> S { ... }
}Provided Methods§
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random_iter<T>(&mut self) -> Iter<StandardUniform, &mut Self, T> ⓘ
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_bool(&mut self, p: f64) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn sample<T, D: Distribution<T>>(&mut self, distr: D) -> T
fn sample_iter<T, D>(&mut self, distr: D) -> Iter<D, &mut Self, T> ⓘwhere
D: Distribution<T>,
Self: Sized,
fn fill<T: Fill + ?Sized>(&mut self, dest: &mut T)
fn map<T, S, F>(&mut self, func: F) -> Map<StandardUniform, F, T, S>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
impl<T: Rng> Rng for &mut T
Implementors§
impl Rng for OsRandomRng
Available on crate feature
os-random only.