Expand description
Generating random samples from probability distributions.
§Re-exports
This crate is a super-set of the rand::distributions module. See the
rand::distributions module documentation for an overview of the core
Distribution trait and implementations.
The following are re-exported:
- The
Distributiontrait andDistIterhelper type - The
Standard,Alphanumeric,Uniform,OpenClosed01,Open01,Bernoulli, andWeightedIndexdistributions
§Distributions
This crate provides the following probability distributions:
- Related to real-valued quantities that grow linearly
(e.g. errors, offsets):
Normaldistribution, andStandardNormalas a primitiveSkewNormaldistributionCauchydistribution
- Related to Bernoulli trials (yes/no events, with a given probability):
BinomialdistributionGeometricdistributionHypergeometricdistribution
- Related to positive real-valued quantities that grow exponentially
(e.g. prices, incomes, populations):
LogNormaldistribution
- Related to the occurrence of independent events at a given rate:
- Gamma and derived distributions:
GammadistributionChiSquareddistributionStudentTdistributionFisherFdistribution
- Triangular distribution:
BetadistributionTriangulardistribution
- Multivariate probability distributions
DirichletdistributionUnitSpheredistributionUnitBalldistributionUnitCircledistributionUnitDiscdistribution
- Alternative implementation for weighted index sampling
WeightedAliasIndexdistribution
- Misc. distributions
InverseGaussiandistributionNormalInverseGaussiandistribution
Re-exports§
pub use weighted_alias::WeightedAliasIndex;pub use num_traits;
Modules§
- uniform
- A distribution uniformly sampling numbers within a given range.
- weighted_
alias - This module contains an implementation of alias method for sampling random indices with probabilities proportional to a collection of weights.
Structs§
- Alphanumeric
- Sample a
u8, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9. - Bernoulli
- The Bernoulli distribution.
- Beta
- The Beta distribution with shape parameters
alphaandbeta. - Binomial
- The binomial distribution
Binomial(n, p). - Cauchy
- The Cauchy distribution
Cauchy(median, scale). - ChiSquared
- The chi-squared distribution
χ²(k), wherekis the degrees of freedom. - Dirichlet
- The Dirichlet distribution
Dirichlet(alpha). - Dist
Iter - An iterator that generates random values of
Twith distributionD, usingRas the source of randomness. - Exp
- The exponential distribution
Exp(lambda). - Exp1
- Samples floating-point numbers according to the exponential distribution,
with rate parameter
λ = 1. This is equivalent toExp::new(1.0)or sampling with-rng.gen::<f64>().ln(), but faster. - FisherF
- The Fisher F distribution
F(m, n). - Frechet
- Samples floating-point numbers according to the Fréchet distribution
- Gamma
- The Gamma distribution
Gamma(shape, scale)distribution. - Geometric
- The geometric distribution
Geometric(p)bounded to[0, u64::MAX]. - Gumbel
- Samples floating-point numbers according to the Gumbel distribution
- Hypergeometric
- The hypergeometric distribution
Hypergeometric(N, K, n). - Inverse
Gaussian - The inverse Gaussian distribution
- LogNormal
- The log-normal distribution
ln N(mean, std_dev**2). - Normal
- The normal distribution
N(mean, std_dev**2). - Normal
Inverse Gaussian - The normal-inverse Gaussian distribution
- Open01
- A distribution to sample floating point numbers uniformly in the open
interval
(0, 1), i.e. not including either endpoint. - Open
Closed01 - A distribution to sample floating point numbers uniformly in the half-open
interval
(0, 1], i.e. including 1 but not 0. - Pareto
- Samples floating-point numbers according to the Pareto distribution
- Pert
- The PERT distribution.
- Poisson
- The Poisson distribution
Poisson(lambda). - Skew
Normal - The skew normal distribution
SN(location, scale, shape). - Standard
- A generic random value distribution, implemented for many primitive types. Usually generates values with a numerically uniform distribution, and with a range appropriate to the type.
- Standard
Geometric - Samples integers according to the geometric distribution with success
probability
p = 0.5. This is equivalent toGeometeric::new(0.5), but faster. - Standard
Normal - Samples floating-point numbers according to the normal distribution
N(0, 1)(a.k.a. a standard normal, or Gaussian). This is equivalent toNormal::new(0.0, 1.0)but faster. - StudentT
- The Student t distribution,
t(nu), wherenuis the degrees of freedom. - Triangular
- The triangular distribution.
- Uniform
- Sample values uniformly between two bounds.
- Unit
Ball - Samples uniformly from the unit ball (surface and interior) in three dimensions.
- Unit
Circle - Samples uniformly from the edge of the unit circle in two dimensions.
- Unit
Disc - Samples uniformly from the unit disc in two dimensions.
- Unit
Sphere - Samples uniformly from the surface of the unit sphere in three dimensions.
- Weibull
- Samples floating-point numbers according to the Weibull distribution
- Weighted
Index - A distribution using weighted sampling of discrete items
- Zeta
- Samples integers according to the zeta distribution.
- Zipf
- Samples integers according to the Zipf distribution.
Enums§
- Bernoulli
Error - Error type returned from
Bernoulli::new. - Beta
Error - Error type returned from
Beta::new. - Binomial
Error - Error type returned from
Binomial::new. - Cauchy
Error - Error type returned from
Cauchy::new. - ChiSquared
Error - Error type returned from
ChiSquared::newandStudentT::new. - Dirichlet
Error - Error type returned from
Dirchlet::new. - ExpError
- Error type returned from
Exp::new. - FisherF
Error - Error type returned from
FisherF::new. - Frechet
Error - Error type returned from
Frechet::new. - Gamma
Error - Error type returned from
Gamma::new. - GeoError
- Error type returned from
Geometric::new. - Gumbel
Error - Error type returned from
Gumbel::new. - Hyper
GeoError - Error type returned from
Hypergeometric::new. - Inverse
Gaussian Error - Error type returned from
InverseGaussian::new - Normal
Error - Error type returned from
Normal::newandLogNormal::new. - Normal
Inverse Gaussian Error - Error type returned from
NormalInverseGaussian::new - Pareto
Error - Error type returned from
Pareto::new. - Pert
Error - Error type returned from
Pertconstructors. - Poisson
Error - Error type returned from
Poisson::new. - Skew
Normal Error - Error type returned from
SkewNormal::new. - Triangular
Error - Error type returned from
Triangular::new. - Weibull
Error - Error type returned from
Weibull::new. - Weighted
Error - Error type returned from
WeightedIndex::new. - Zeta
Error - Error type returned from
Zeta::new. - Zipf
Error - Error type returned from
Zipf::new.
Traits§
- Distribution
- Types (distributions) that can be used to create a random instance of
T.