pub struct ScriptedRng { /* private fields */ }Expand description
A RandomSource that returns a fixed list of rolls, in order. For
tests that need an exact trace of rolls. Percent rolls and
roll_below draws come from two separate
lists.
Implementations§
Source§impl ScriptedRng
impl ScriptedRng
Sourcepub fn new(rolls: impl Into<Vec<u8>>) -> Self
pub fn new(rolls: impl Into<Vec<u8>>) -> Self
Returns rolls one by one. Each must be in 0..=99.
Sourcepub fn with_below(self, draws: impl Into<Vec<u32>>) -> Self
pub fn with_below(self, draws: impl Into<Vec<u32>>) -> Self
Also returns draws, one by one, from
roll_below.
Sourcepub fn consumed_below(&self) -> usize
pub fn consumed_below(&self) -> usize
How many roll_below draws have been taken so far.
Trait Implementations§
Source§impl Clone for ScriptedRng
impl Clone for ScriptedRng
Source§fn clone(&self) -> ScriptedRng
fn clone(&self) -> ScriptedRng
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScriptedRng
impl Debug for ScriptedRng
Source§impl Default for ScriptedRng
impl Default for ScriptedRng
Source§fn default() -> ScriptedRng
fn default() -> ScriptedRng
Returns the “default value” for a type. Read more
impl Eq for ScriptedRng
Source§impl PartialEq for ScriptedRng
impl PartialEq for ScriptedRng
Source§impl RandomSource for ScriptedRng
impl RandomSource for ScriptedRng
impl StructuralPartialEq for ScriptedRng
Auto Trait Implementations§
impl Freeze for ScriptedRng
impl RefUnwindSafe for ScriptedRng
impl Send for ScriptedRng
impl Sync for ScriptedRng
impl Unpin for ScriptedRng
impl UnsafeUnpin for ScriptedRng
impl UnwindSafe for ScriptedRng
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