Trait bevy_math::sampling::standard::FromRng

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

Ergonomics trait for a type with a Standard 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 + ?Sized>(rng: &mut R) -> Self

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

Object Safety§

This trait is not object safe.

Implementors§