bevy_math::sampling::standard

Trait FromRng

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

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§