Skip to main content

Random

Trait Random 

Source
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§

Source

fn random_with(rng: &mut Rng) -> Self

Returns a random value using the given Rng.

Provided Methods§

Source

fn random() -> Self

Returns a random value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Random for Uuid

Source§

impl<T> Random for T