pub struct GameRng { /* private fields */ }
Expand description
Game random number generator with seed support
Implementations§
Source§impl GameRng
impl GameRng
Sourcepub fn gen_range(&mut self, max: usize) -> usize
pub fn gen_range(&mut self, max: usize) -> usize
Generate a random value between 0 and max (exclusive)
Sourcepub fn gen_bool(&mut self, probability: f64) -> bool
pub fn gen_bool(&mut self, probability: f64) -> bool
Generate a random boolean with given probability
Sourcepub fn gen_tile_value(&mut self) -> u32
pub fn gen_tile_value(&mut self) -> u32
Generate a random tile value (2 or 4 with 90/10 probability)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GameRng
impl RefUnwindSafe for GameRng
impl Send for GameRng
impl Sync for GameRng
impl Unpin for GameRng
impl UnwindSafe for GameRng
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more