Struct ndarray_rand::rand_distr::Geometric [−][src]
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
impl RefUnwindSafe for Geometric
impl Send for Geometric
impl Sync for Geometric
impl Unpin for Geometric
impl UnwindSafe for Geometric
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,