[][src]Struct rv::dist::Geometric

pub struct Geometric {
    pub p: f64,
}

Geometric distribution over x in {0, 1, 2, 3, ... }.

Example

extern crate rv;
extern crate rand;

use rv::prelude::*;

// Create Geometric(p=0.5)
let geom = Geometric::new(0.5).unwrap();

// Draw Samples
let mut rng = rand::thread_rng();
let xs: Vec<u32> = geom.sample(100, &mut rng);
assert_eq!(xs.len(), 100)

Fields

p: f64

Methods

impl Geometric[src]

pub fn new(p: f64) -> Result<Self>[src]

Trait Implementations

impl<X> Rv<X> for Geometric where
    X: Unsigned + Integer + FromPrimitive + ToPrimitive + Saturating + Bounded
[src]

fn f(&self, x: &X) -> f64[src]

Probability function Read more

fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<X>[src]

Multiple draws of the Rv Read more

impl<X> Support<X> for Geometric where
    X: Unsigned + Integer
[src]

impl<X> Cdf<X> for Geometric where
    X: Unsigned + Integer + FromPrimitive + ToPrimitive + Saturating + Bounded
[src]

fn sf(&self, x: &X) -> f64[src]

Survival function, 1 - CDF(x)

impl<X> DiscreteDistr<X> for Geometric where
    X: Unsigned + Integer + FromPrimitive + ToPrimitive + Saturating + Bounded
[src]

fn pmf(&self, x: &X) -> f64[src]

Probability mass function (PMF) at x Read more

fn ln_pmf(&self, x: &X) -> f64[src]

Natural logarithm of the probability mass function (PMF) Read more

impl Mean<f64> for Geometric[src]

impl Variance<f64> for Geometric[src]

impl Entropy for Geometric[src]

impl Skewness for Geometric[src]

impl Kurtosis for Geometric[src]

impl PartialOrd<Geometric> for Geometric[src]

impl<'_> From<&'_ Geometric> for String[src]

impl PartialEq<Geometric> for Geometric[src]

impl Clone for Geometric[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for Geometric[src]

impl Display for Geometric[src]

impl Debug for Geometric[src]

Auto Trait Implementations

impl Send for Geometric

impl Sync for Geometric

Blanket Implementations

impl<T> ApiReady for T where
    T: Clone + Debug + PartialOrd<T> + PartialEq<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>,