[][src]Trait nanorand::rand::RNG

pub trait RNG: Clone {
    type Output: AsRef<[u8]>;
    fn rand(&mut self) -> Self::Output;
fn rand_with_seed(seed: &[u8]) -> Self::Output;
fn reseed(&mut self, new_seed: &[u8]); fn generate<R: RandomGen<Self>>(&mut self) -> R { ... }
fn generate_range<R: RandomRange<Self>>(&mut self, lower: R, upper: R) -> R { ... }
fn shuffle<I, S: AsMut<[I]>>(&mut self, target: S) { ... } }

A trait that represents a random number generator.

Associated Types

type Output: AsRef<[u8]>

The byte output that this RNG emits.

Loading content...

Required methods

fn rand(&mut self) -> Self::Output

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

fn rand_with_seed(seed: &[u8]) -> Self::Output

Generates a random sequence of bytes, with a custom seed.

fn reseed(&mut self, new_seed: &[u8])

Reseeds the RNG using a custom seed.

Loading content...

Provided methods

fn generate<R: RandomGen<Self>>(&mut self) -> R

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

fn generate_range<R: RandomRange<Self>>(&mut self, lower: R, upper: R) -> R

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

fn shuffle<I, S: AsMut<[I]>>(&mut self, target: S)

Shuffle a slice, using the RNG.

Loading content...

Implementors

impl RNG for ChaCha[src]

type Output = [u8; 64]

impl RNG for Pcg64[src]

type Output = [u8; 8]

impl RNG for WyRand[src]

type Output = [u8; 8]

Loading content...