Struct probability::distribution::Bernoulli
[−]
[src]
pub struct Bernoulli {
// some fields omitted
}A Bernoulli distribution.
Methods
impl Bernoulli[src]
fn new(p: f64) -> Self
Create a Bernoulli distribution with success probability p.
It should hold that p > 0 and p < 1.
fn with_failure(q: f64) -> Self
Create a Bernoulli distribution with failure probability q.
It should hold that q > 0 and q < 1. This constructor is preferable
when q is very small.
fn p(&self) -> f64
Return the success probability.
fn q(&self) -> f64
Return the failure probability.
Trait Implementations
impl Copy for Bernoulli[src]
impl Clone for Bernoulli[src]
fn clone(&self) -> Bernoulli
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 Discrete for Bernoulli[src]
impl Distribution for Bernoulli[src]
type Value = u8
The type of outcomes.
fn distribution(&self, x: f64) -> f64
Compute the cumulative distribution function.