Struct std::rand::reseeding::ReseedingRng [] [src]

pub struct ReseedingRng<R, Rsdr> {
    rng: R,
    generation_threshold: usize,
    bytes_generated: usize,
    pub reseeder: Rsdr,
}
Unstable (rand)

: use rand from crates.io

A wrapper around any RNG which reseeds the underlying RNG after it has generated a certain number of random bytes.

Fields

rng
Unstable (rand)

: use rand from crates.io

generation_threshold
Unstable (rand)

: use rand from crates.io

bytes_generated
Unstable (rand)

: use rand from crates.io

reseeder
Unstable (rand)

: use rand from crates.io

Controls the behaviour when reseeding the RNG.

Methods

impl<R, Rsdr> ReseedingRng<R, Rsdr> where R: Rng, Rsdr: Reseeder<R>

fn new(rng: R, generation_threshold: usize, reseeder: Rsdr) -> ReseedingRng<R, Rsdr>

Unstable (rand)

: use rand from crates.io

Create a new ReseedingRng with the given parameters.

Arguments

  • rng: the random number generator to use.
  • generation_threshold: the number of bytes of entropy at which to reseed the RNG.
  • reseeder: the reseeding object to use.

fn reseed_if_necessary(&mut self)

Unstable (rand)

: use rand from crates.io

Reseed the internal RNG if the number of bytes that have been generated exceed the threshold.

Trait Implementations

impl<R, Rsdr> Rng for ReseedingRng<R, Rsdr> where R: Rng, Rsdr: Reseeder<R>

fn next_u32(&mut self) -> u32

fn next_u64(&mut self) -> u64

fn fill_bytes(&mut self, dest: &mut [u8])

fn next_f32(&mut self) -> f32

fn next_f64(&mut self) -> f64

fn gen<T>(&mut self) -> T where T: Rand

fn gen_iter<T>(&'a mut self) -> Generator<'a, T, Self> where T: Rand

fn gen_range<T>(&mut self, low: T, high: T) -> T where T: SampleRange + PartialOrd<T>

fn gen_weighted_bool(&mut self, n: usize) -> bool

fn gen_ascii_chars(&'a mut self) -> AsciiGenerator<'a, Self>

fn choose<T>(&mut self, values: &'a [T]) -> Option<&'a T>

fn shuffle<T>(&mut self, values: &mut [T])

impl<S, R, Rsdr> SeedableRng<(Rsdr, S)> for ReseedingRng<R, Rsdr> where Rsdr: Reseeder<R> + Default, R: SeedableRng<S>

fn reseed(&mut self, (Rsdr, S))

fn from_seed((Rsdr, S)) -> ReseedingRng<R, Rsdr>