Trait randomize::Gen32

source ·
pub trait Gen32 {
    // Required method
    fn next_u32(&mut self) -> u32;

    // Provided methods
    fn next_i32(&mut self) -> i32 { ... }
    fn next_bool(&mut self) -> bool { ... }
    fn next_f32_unit(&mut self) -> f32 { ... }
    fn d4(&mut self) -> i32 { ... }
    fn d6(&mut self) -> i32 { ... }
    fn d8(&mut self) -> i32 { ... }
    fn d10(&mut self) -> i32 { ... }
    fn d12(&mut self) -> i32 { ... }
    fn d20(&mut self) -> i32 { ... }
}
Expand description

A trait for pseudo-random number generators with 32-bit output per step.

Required Methods§

source

fn next_u32(&mut self) -> u32

Makes the generator create the next output.

All u32 values should have equal chance of occuring.

Provided Methods§

source

fn next_i32(&mut self) -> i32

Gives a uniformly distributed value.

source

fn next_bool(&mut self) -> bool

Gives a uniformly distributed value.

source

fn next_f32_unit(&mut self) -> f32

Gives a value in the range 0.0 ..= 1.0

source

fn d4(&mut self) -> i32

Gives a value in the range 1 ..= 4

source

fn d6(&mut self) -> i32

Gives a value in the range 1 ..= 6

source

fn d8(&mut self) -> i32

Gives a value in the range 1 ..= 8

source

fn d10(&mut self) -> i32

Gives a value in the range 1 ..= 10

source

fn d12(&mut self) -> i32

Gives a value in the range 1 ..= 12

source

fn d20(&mut self) -> i32

Gives a value in the range 1 ..= 20

Implementors§

source§

impl Gen32 for PCG32

source§

impl<const K: usize> Gen32 for PCG32K<K>