pub trait Random: Sized {
// Required method
fn random_with(rng: &mut Rng) -> Self;
// Provided method
fn random() -> Self { ... }
}Expand description
A trait for types that can be created randomly.
Required Methods§
Sourcefn random_with(rng: &mut Rng) -> Self
fn random_with(rng: &mut Rng) -> Self
Returns a random value using the given Rng.
Provided Methods§
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.