RandomSource

Trait RandomSource 

Source
pub trait RandomSource {
    type Rng: RngCore + 'static;

    // Required method
    fn get_rng(&self, index: usize) -> Self::Rng;

    // Provided method
    fn get_rng_boxed(&self, index: usize) -> Box<dyn RngCore> { ... }
}
Expand description

Source of randomness

§Streams

When Passgen generates multiple random sequences, it could use a single stream of randomness sequentially, however this makes it impossible to use multi-threading. For that reason, every sequence it generates uses an independent stream of randomness. For nondeterministic randomness, these independent streams can actually be the same stream. For deterministic sources of randomness, these streams should be independent and each stream should always produce the same (pseudorandom) data.

Required Associated Types§

Source

type Rng: RngCore + 'static

Underlying type of the randomness source.

Required Methods§

Source

fn get_rng(&self, index: usize) -> Self::Rng

Return a stream of randomness for the given index.

Provided Methods§

Source

fn get_rng_boxed(&self, index: usize) -> Box<dyn RngCore>

Return a type-erased stream of randomness for the given index.

Implementors§