pub trait GenerateRandom {
// Required method
fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self;
}
Expand description
Enable randomly generating values of a type.
This trait can be implemented using the derive
macro of the same name: GenerateRandom
.
Required Methods§
Sourcefn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self
fn generate_random<R: Rng + ?Sized>(rng: &mut R) -> Self
Create a new random value of this type.
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.