Skip to main content

Rng

Trait Rng 

Source
pub trait Rng {
    // 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 tower middleware.

Required Methods§

Source

fn next_u64(&mut self) -> u64

Generate a random u64.

Provided Methods§

Source

fn next_f64(&mut self) -> f64

Generate a random f64 between [0, 1).

Source

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

Randomly pick a value within the range.

§Panic
  • If range.start >= range.end this will panic in debug mode.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

Source§

fn next_u64(&mut self) -> u64

Implementors§

Source§

impl<H> Rng for HasherRng<H>
where H: BuildHasher,