Skip to main content

RandomSource

Trait RandomSource 

Source
pub trait RandomSource {
    // Required method
    fn gen_below(&mut self, max_exclusive: u32) -> u32;
}
Expand description

A source of bounded random integers in 0..max_exclusive.

Implement this for deterministic test doubles, mirroring the injectable RandomSource of the TypeScript packages.

Required Methods§

Source

fn gen_below(&mut self, max_exclusive: u32) -> u32

Return a value in 0..max_exclusive. max_exclusive must be positive.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§