Trait nanorand::rand::Rng

source ·
pub trait Rng<const OUTPUT: usize>: Clone {
    // Required method
    fn rand(&mut self) -> [u8; OUTPUT];

    // Provided methods
    fn generate<Generated>(&mut self) -> Generated
       where Generated: RandomGen<Self, OUTPUT> { ... }
    fn fill_bytes<Bytes>(&mut self, buffer: Bytes)
       where Bytes: AsMut<[u8]> { ... }
    fn fill<Contents, Array>(&mut self, target: Array)
       where Contents: RandomGen<Self, OUTPUT>,
             Array: AsMut<[Contents]> { ... }
    fn generate_range<Number, Bounds>(&mut self, range: Bounds) -> Number
       where Number: RandomRange<Self, OUTPUT>,
             Bounds: RangeBounds<Number> { ... }
    fn shuffle<Contents, Array>(&mut self, target: Array)
       where Array: AsMut<[Contents]> { ... }
}
Expand description

A trait that represents a random number generator.

Required Methods§

source

fn rand(&mut self) -> [u8; OUTPUT]

Generates a random sequence of bytes, seeding from the internal state.

Provided Methods§

source

fn generate<Generated>(&mut self) -> Generated
where Generated: RandomGen<Self, OUTPUT>,

Generates a random of the specified type, seeding from the internal state.

source

fn fill_bytes<Bytes>(&mut self, buffer: Bytes)
where Bytes: AsMut<[u8]>,

Fill an array of bytes with randomness.

source

fn fill<Contents, Array>(&mut self, target: Array)
where Contents: RandomGen<Self, OUTPUT>, Array: AsMut<[Contents]>,

Fill an array with the specified type.

source

fn generate_range<Number, Bounds>(&mut self, range: Bounds) -> Number
where Number: RandomRange<Self, OUTPUT>, Bounds: RangeBounds<Number>,

Generates a random of the specified type, seeding from the internal state.

source

fn shuffle<Contents, Array>(&mut self, target: Array)
where Array: AsMut<[Contents]>,

Shuffle a slice, using the RNG.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Rng<8> for WyRand