Struct rand::reseeding::ReseedingRng
[-] [+]
[src]
pub struct ReseedingRng<R, Rsdr> { pub reseeder: Rsdr, // some fields omitted }
A wrapper around any RNG which reseeds the underlying RNG after it has generated a certain number of random bytes.
Fields
reseeder | Controls the behaviour when reseeding the RNG. |
Methods
impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr>
fn new(rng: R, generation_threshold: u64, reseeder: Rsdr) -> ReseedingRng<R, Rsdr>
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)
Reseed the internal RNG if the number of bytes that have been generated exceed the threshold.
Trait Implementations
impl<R: Rng, Rsdr: Reseeder<R>> Rng for ReseedingRng<R, Rsdr>
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: Rand>(&mut self) -> T
fn gen_iter<'a, T: Rand>(&'a mut self) -> Generator<'a, T, Self>
fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T
fn gen_weighted_bool(&mut self, n: u32) -> bool
fn gen_ascii_chars<'a>(&'a mut self) -> AsciiGenerator<'a, Self>
fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T>
fn shuffle<T>(&mut self, values: &mut [T])
impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R> + Default> SeedableRng<(Rsdr, S)> for ReseedingRng<R, Rsdr>
fn reseed(&mut self, (rsdr, seed): (Rsdr, S))
fn from_seed((rsdr, seed): (Rsdr, S)) -> ReseedingRng<R, Rsdr>
Create a new ReseedingRng
from the given reseeder and
seed. This uses a default value for generation_threshold
.