Struct ndarray_rand::rand_distr::Geometric[][src]

pub struct Geometric { /* fields omitted */ }

The geometric distribution Geometric(p) bounded to [0, u64::MAX].

This is the probability distribution of the number of failures before the first success in a series of Bernoulli trials. It has the density function f(k) = (1 - p)^k p for k >= 0, where p is the probability of success on each trial.

This is the discrete analogue of the exponential distribution.

Note that StandardGeometric is an optimised implementation for p = 0.5.

Example

use rand_distr::{Geometric, Distribution};

let geo = Geometric::new(0.25).unwrap();
let v = geo.sample(&mut rand::thread_rng());
println!("{} is from a Geometric(0.25) distribution", v);

Implementations

impl Geometric[src]

pub fn new(p: f64) -> Result<Geometric, Error>[src]

Construct a new Geometric with the given shape parameter p (probablity of success on each trial).

Trait Implementations

impl Clone for Geometric[src]

impl Copy for Geometric[src]

impl Debug for Geometric[src]

impl Distribution<u64> for Geometric[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,