Struct prob::Probability
[−]
[src]
pub struct Probability<T: Num>(pub T);
An independent probability.
This represents some probability of some abstract, isolated event occuring. Note that the even have to be isolated (independent of any other event) for the operations to be correct. As such, you shouldn't do calculations with conditional events. Stronger methods needs to be used for this.
This newtype simply wraps some numeral type and provides it with operations:
&
for independent and.|
for independent or.^
for independent mutual exclusivity.!
for inverse probability.
Methods
impl<T: Num + PartialOrd> Probability<T>
[src]
fn certain() -> Probability<T>
The probability representing a "almost certain" condition.
"Almost certain" (a.c.) should not be equated with "certain", because something can be practically certain, but not impossible to fail. For example, pick a random natural number from an uniform distribution. Not picking a specific number would be almost certain, but it is not impossible, because an argument for impossibility could be applied to any number.
For practical purposes, though, there is no difference between certain and almost certain.
fn never() -> Probability<T>
The inverse of an "almost certain" condition (almost never).
fn half(self) -> Probability<T>
Half the probability.
fn fifty() -> Probability<T>
A fifty-fifty probability (0.5).
fn disjointed_or(self, rhs: Probability<T>) -> Probability<T>
'or' for mutually exclusive events
Trait Implementations
impl<T: Copy + Num> Copy for Probability<T>
[src]
impl<T: Clone + Num> Clone for Probability<T>
[src]
fn clone(&self) -> Probability<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: PartialEq + Num> PartialEq for Probability<T>
[src]
fn eq(&self, __arg_0: &Probability<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Probability<T>) -> bool
This method tests for !=
.
impl<T: Eq + Num> Eq for Probability<T>
[src]
impl<T: Debug + Num> Debug for Probability<T>
[src]
impl<T: PartialOrd + Num> PartialOrd for Probability<T>
[src]
fn partial_cmp(&self, __arg_0: &Probability<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Probability<T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Probability<T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Probability<T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Probability<T>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Ord + Num> Ord for Probability<T>
[src]
fn cmp(&self, __arg_0: &Probability<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<T: Num + PartialOrd> Not for Probability<T>
[src]
type Output = Probability<T>
The resulting type after applying the !
operator
fn not(self) -> Probability<T>
The method for the unary !
operator
impl<T: Num + PartialOrd> BitAnd for Probability<T>
[src]
type Output = Probability<T>
The resulting type after applying the &
operator
fn bitand(self, rhs: Probability<T>) -> Probability<T>
The method for the &
operator
impl<T: Num + Clone + PartialOrd> BitOr for Probability<T>
[src]
type Output = Probability<T>
The resulting type after applying the |
operator
fn bitor(self, rhs: Probability<T>) -> Probability<T>
The method for the |
operator
impl<T: Num + Clone + PartialOrd> BitXor for Probability<T>
[src]
type Output = Probability<T>
The resulting type after applying the ^
operator
fn bitxor(self, rhs: Probability<T>) -> Probability<T>
The method for the ^
operator