Skip to main content

RandomSource

Trait RandomSource 

Source
pub trait RandomSource {
    // Required methods
    fn roll_percent(&mut self) -> u8;
    fn roll_below(&mut self, n: u32) -> u32;
}
Expand description

Where game rules get their random numbers from.

Required Methods§

Source

fn roll_percent(&mut self) -> u8

A uniform, unbiased integer in 0..=99.

Source

fn roll_below(&mut self, n: u32) -> u32

A uniform, unbiased integer in 0..n. n must be at least 1; 0 gives 0.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§