Rng

Trait Rng 

Source
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§

Source

fn random<T>(&mut self) -> T

Source

fn random_iter<T>(&mut self) -> Iter<StandardUniform, &mut Self, T>

Source

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Source

fn random_bool(&mut self, p: f64) -> bool

Source

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Source

fn sample<T, D: Distribution<T>>(&mut self, distr: D) -> T

Source

fn sample_iter<T, D>(&mut self, distr: D) -> Iter<D, &mut Self, T>
where D: Distribution<T>, Self: Sized,

Source

fn fill<T: Fill + ?Sized>(&mut self, dest: &mut T)

Source

fn map<T, S, F>(&mut self, func: F) -> Map<StandardUniform, F, T, S>
where StandardUniform: Distribution<T>, F: Fn(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§

Source§

impl<T: Rng> Rng for &mut T

Implementors§

Source§

impl Rng for OsRandomRng

Available on crate feature os-random only.
Source§

impl Rng for Xoshiro256