pub struct Distribution(/* private fields */);Expand description
A probability distribution, whose constructor checked its parameters.
Implementations§
Source§impl Distribution
impl Distribution
Sourcepub fn pdf(&self, x: f64) -> f64
pub fn pdf(&self, x: f64) -> f64
The density at x, or for a discrete distribution the probability of x.
Sourcepub fn quantile(&self, p: f64) -> f64
pub fn quantile(&self, p: f64) -> f64
The least x whose cdf is at least p. p outside 0 to 1 gives NaN.
Sourcepub fn words(&self) -> usize
pub fn words(&self) -> usize
The words that one attempt of a draw reads, which each item of samples packs (random::Items).
Sourcepub fn samples(&self, items: &mut Items, out: &mut [f64])
pub fn samples(&self, items: &mut Items, out: &mut [f64])
Fills out with values drawn from the distribution, one for each item of items, which packs this distribution’s words. A normal distribution’s item gives two values, from one pair of uniform words.
Sourcepub fn is_discrete(&self) -> bool
pub fn is_discrete(&self) -> bool
Whether the distribution’s values are whole numbers.
Source§impl Distribution
impl Distribution
Sourcepub fn normal(mean: f64, sd: f64) -> Result<Distribution, Invalid>
pub fn normal(mean: f64, sd: f64) -> Result<Distribution, Invalid>
The normal distribution with this mean and standard deviation.
Sourcepub fn uniform(min: f64, max: f64) -> Result<Distribution, Invalid>
pub fn uniform(min: f64, max: f64) -> Result<Distribution, Invalid>
The uniform distribution from min to max.
Sourcepub fn beta(a: f64, b: f64) -> Result<Distribution, Invalid>
pub fn beta(a: f64, b: f64) -> Result<Distribution, Invalid>
The beta distribution with shapes a and b.
Sourcepub fn cauchy(location: f64, scale: f64) -> Result<Distribution, Invalid>
pub fn cauchy(location: f64, scale: f64) -> Result<Distribution, Invalid>
The Cauchy distribution with this location and scale.
Sourcepub fn chi_squared(df: f64) -> Result<Distribution, Invalid>
pub fn chi_squared(df: f64) -> Result<Distribution, Invalid>
The chi-squared distribution with df degrees of freedom: the gamma distribution with shape df/2 and scale 2.
Sourcepub fn exponential(rate: f64) -> Result<Distribution, Invalid>
pub fn exponential(rate: f64) -> Result<Distribution, Invalid>
The exponential distribution with this rate.
Sourcepub fn fisher(df1: f64, df2: f64) -> Result<Distribution, Invalid>
pub fn fisher(df1: f64, df2: f64) -> Result<Distribution, Invalid>
The F distribution with df1 and df2 degrees of freedom.
Sourcepub fn gamma(shape: f64, scale: f64) -> Result<Distribution, Invalid>
pub fn gamma(shape: f64, scale: f64) -> Result<Distribution, Invalid>
The gamma distribution with this shape and scale.
Sourcepub fn inverse_gamma(shape: f64, scale: f64) -> Result<Distribution, Invalid>
pub fn inverse_gamma(shape: f64, scale: f64) -> Result<Distribution, Invalid>
The inverse gamma distribution with this shape and scale.
Sourcepub fn laplace(location: f64, scale: f64) -> Result<Distribution, Invalid>
pub fn laplace(location: f64, scale: f64) -> Result<Distribution, Invalid>
The Laplace distribution with this location and scale.
Sourcepub fn logistic(location: f64, scale: f64) -> Result<Distribution, Invalid>
pub fn logistic(location: f64, scale: f64) -> Result<Distribution, Invalid>
The logistic distribution with this location and scale.
Sourcepub fn log_normal(location: f64, scale: f64) -> Result<Distribution, Invalid>
pub fn log_normal(location: f64, scale: f64) -> Result<Distribution, Invalid>
The log-normal distribution whose logarithm has this mean, the location, and this standard deviation, the scale.
Sourcepub fn student_t(df: f64) -> Result<Distribution, Invalid>
pub fn student_t(df: f64) -> Result<Distribution, Invalid>
Student’s t distribution with df degrees of freedom.
Sourcepub fn weibull(shape: f64, scale: f64) -> Result<Distribution, Invalid>
pub fn weibull(shape: f64, scale: f64) -> Result<Distribution, Invalid>
The Weibull distribution with this shape and scale.
Trait Implementations§
Source§impl Clone for Distribution
impl Clone for Distribution
Source§fn clone(&self) -> Distribution
fn clone(&self) -> Distribution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Distribution
Source§impl Debug for Distribution
impl Debug for Distribution
Source§impl PartialEq for Distribution
impl PartialEq for Distribution
impl StructuralPartialEq for Distribution
Auto Trait Implementations§
impl Forget for Distribution
impl Freeze for Distribution
impl RefUnwindSafe for Distribution
impl Send for Distribution
impl Sync for Distribution
impl Unpin for Distribution
impl UnsafeUnpin for Distribution
impl UnwindSafe for Distribution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more