pub struct Distribution { /* private fields */ }
Expand description
A computed distribution for a bounded dice expression. (“bounded”: does not support exploding dice.)
Implementations§
Source§impl Distribution
impl Distribution
Sourcepub fn probability(&self, value: isize) -> Ratio<usize>
pub fn probability(&self, value: isize) -> Ratio<usize>
Give the probability of this value occurring in this distribution.
pub fn probability_f64(&self, value: isize) -> f64
Sourcepub fn total(&self) -> usize
pub fn total(&self) -> usize
Report the total number of occurrences in this expression, i.e. the number of possible rolls (rather than the number of distinct values).
Sourcepub fn occurrences(&self) -> Occurrences<'_>
pub fn occurrences(&self) -> Occurrences<'_>
Iterator over (value, occurrences) tuples in this distribution. Reports values with nonzero occurrence in ascending order of value.
Trait Implementations§
Source§impl Add<&Distribution> for &Distribution
impl Add<&Distribution> for &Distribution
Source§type Output = Distribution
type Output = Distribution
The resulting type after applying the
+
operator.Source§impl Add for Distribution
impl Add for Distribution
Source§type Output = Distribution
type Output = Distribution
The resulting type after applying the
+
operator.Source§impl Clone for Distribution
impl Clone for Distribution
Source§fn clone(&self) -> Distribution
fn clone(&self) -> Distribution
Returns a duplicate of the value. Read more
1.0.0 · 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 Distribution
impl Debug for Distribution
Source§impl Neg for &Distribution
impl Neg for &Distribution
Source§impl Neg for Distribution
impl Neg for Distribution
Source§impl PartialEq for Distribution
impl PartialEq for Distribution
Source§impl Sum for Distribution
impl Sum for Distribution
impl Eq for Distribution
impl StructuralPartialEq for Distribution
Auto Trait Implementations§
impl Freeze for Distribution
impl RefUnwindSafe for Distribution
impl Send for Distribution
impl Sync for Distribution
impl Unpin for Distribution
impl UnwindSafe for Distribution
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more