pub struct FastRand(/* private fields */);
Expand description
Generates rolls with random values using [fastrand]. Requires the fastrand
feature (enabled by default).
§Examples
§Default fastrand roller
use tyche::dice::{roller::{FastRand as FastRandRoller, Roller}, Dice};
let mut roller = FastRandRoller::default();
let dice = Dice::new(4, 6);
let _ = roller.roll(&dice, true)?;
let _ = roller.roll(&dice, true)?;
§Custom fastrand roller (seeded)
use tyche::dice::{roller::{FastRand as FastRandRoller, Roller}, Dice};
use fastrand::Rng;
let mut roller = FastRandRoller::new(Rng::with_seed(0x750c38d574400));
let dice = Dice::new(4, 6);
let _ = roller.roll(&dice, true)?;
let _ = roller.roll(&dice, true)?;
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for FastRand
impl Send for FastRand
impl Sync for FastRand
impl Unpin for FastRand
impl UnwindSafe for FastRand
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
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
Convert an item of the sequence into a [
MaybeRef
].