Trait bevy::math::prelude::FromRng

pub trait FromRng: Sized
where Standard: Distribution<Self>,
{ // Provided method fn from_rng<R>(rng: &mut R) -> Self where R: Rng + ?Sized { ... } }
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.


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

Provided Methods§

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.

Object Safety§

This trait is not object safe.



impl FromRng for Quat


impl FromRng for Dir2


impl FromRng for Dir3


impl FromRng for Dir3A


impl FromRng for Rot2