FromRng

Trait FromRng 

Source
pub trait FromRng: Sized{
    // Provided method
    fn from_rng<R>(rng: &mut R) -> Self
       where R: Rng + ?Sized { ... }
}
Expand description

Ergonomics trait for a type with a StandardUniform distribution, allowing values to be generated uniformly from an Rng by a method in its own namespace.

Example

let mut rng = StdRng::seed_from_u64(451);
let random_dir = Dir3::from_rng(&mut rng);

Provided Methods§

Source

fn from_rng<R>(rng: &mut R) -> Self
where R: Rng + ?Sized,

Construct a value of this type uniformly at random using rng as the source of randomness.

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.

Implementors§