rama::utils::rng

Trait Rng

pub trait Rng:
    Send
    + Sync
    + 'static {
    // Required method
    fn next_u64(&mut self) -> u64;

    // Provided methods
    fn next_f64(&mut self) -> f64 { ... }
    fn next_range(&mut self, range: Range<u64>) -> u64 { ... }
}
Expand description

A simple PRNG trait for use within middleware.

Required Methods§

fn next_u64(&mut self) -> u64

Generate a random u64.

Provided Methods§

fn next_f64(&mut self) -> f64

Generate a random f64 between [0, 1).

fn next_range(&mut self, range: Range<u64>) -> u64

Randomly pick a value within the range.

§Panic
  • If start < end this will panic in debug mode.

Implementations on Foreign Types§

§

impl<R> Rng for Box<R>
where R: Rng + ?Sized,

§

fn next_u64(&mut self) -> u64

Implementors§

§

impl<H> Rng for HasherRng<H>
where H: BuildHasher + Send + Sync + 'static,