Expand description
Generating random samples from probability distributions.
§Re-exports
This crate is a super-set of the rand::distr
module. See the
rand::distr
module documentation for an overview of the core
Distribution
trait and implementations.
The following are re-exported:
- The
Distribution
trait andDistIter
helper type - The
StandardUniform
,Alphanumeric
,Uniform
,OpenClosed01
,Open01
,Bernoulli
, andWeightedIndex
distributions
§Distributions
This crate provides the following probability distributions:
- Related to real-valued quantities that grow linearly
(e.g. errors, offsets):
Normal
distribution, andStandardNormal
as a primitiveSkewNormal
distributionCauchy
distribution
- Related to Bernoulli trials (yes/no events, with a given probability):
Binomial
distributionGeometric
distributionHypergeometric
distribution
- Related to positive real-valued quantities that grow exponentially
(e.g. prices, incomes, populations):
LogNormal
distribution
- Related to the occurrence of independent events at a given rate:
- Gamma and derived distributions:
Gamma
distributionChiSquared
distributionStudentT
distributionFisherF
distribution
- Triangular distribution:
Beta
distributionTriangular
distribution
- Multivariate probability distributions
Dirichlet
distributionUnitSphere
distributionUnitBall
distributionUnitCircle
distributionUnitDisc
distribution
- Alternative implementations for weighted index sampling
WeightedAliasIndex
distributionWeightedTreeIndex
distribution
- Misc. distributions
InverseGaussian
distributionNormalInverseGaussian
distribution
Re-exports§
pub use weighted_alias::WeightedAliasIndex;
pub use weighted_tree::WeightedTreeIndex;
pub use num_traits;
Modules§
- A distribution uniformly sampling numbers within a given range.
- This module contains an implementation of alias method for sampling random indices with probabilities proportional to a collection of weights.
- This module contains an implementation of a tree structure for sampling random indices with probabilities proportional to a collection of weights.
Structs§
- Sample a
u8
, uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9. - The Bernoulli distribution
Bernoulli(p)
. - The Beta distribution
Beta(α, β)
. - The binomial distribution
Binomial(n, p)
. - The Cauchy distribution
Cauchy(x₀, γ)
. - The chi-squared distribution
χ²(k)
. - The Dirichlet distribution
Dirichlet(α₁, α₂, ..., αₖ)
. - An iterator that generates random values of
T
with distributionD
, usingR
as the source of randomness. - The exponential distribution
Exp(λ)
. - The standard exponential distribution
Exp(1)
. - The Fisher F-distribution
F(m, n)
. - The Fréchet distribution
Fréchet(α, μ, σ)
. - The Gamma distribution
Gamma(k, θ)
. - The geometric distribution
Geometric(p)
. - The Gumbel distribution
Gumbel(μ, β)
. - The hypergeometric distribution
Hypergeometric(N, K, n)
. - The inverse Gaussian distribution
IG(μ, λ)
. - The log-normal distribution
ln N(μ, σ²)
. - The Normal distribution
N(μ, σ²)
. - The normal-inverse Gaussian distribution
NIG(α, β)
. - A distribution to sample floating point numbers uniformly in the open interval
(0, 1)
, i.e. not including either endpoint. - A distribution to sample floating point numbers uniformly in the half-open interval
(0, 1]
, i.e. including 1 but not 0. - The Pareto distribution
Pareto(xₘ, α)
. - The PERT distribution
PERT(min, max, mode, shape)
. - Struct used to build a
Pert
- The Poisson distribution
Poisson(λ)
. - The skew normal distribution
SN(ξ, ω, α)
. - The standard geometric distribution
Geometric(0.5)
. - The standard Normal distribution
N(0, 1)
. - The Standard Uniform distribution
- The Student t-distribution
t(ν)
. - The triangular distribution
Triangular(min, max, mode)
. - Sample values uniformly between two bounds.
- Samples uniformly from the volume of the unit ball in three dimensions.
- Samples uniformly from the circumference of the unit circle in two dimensions.
- Samples uniformly from the unit disc in two dimensions.
- Samples uniformly from the surface of the unit sphere in three dimensions.
- The Weibull distribution
Weibull(λ, k)
. - A distribution using weighted sampling of discrete items.
- The Zeta distribution
Zeta(s)
. - The Zipf (Zipfian) distribution
Zipf(n, s)
.
Enums§
- Error type returned from
Bernoulli::new
. - Error type returned from
Beta::new
. - Error type returned from
Binomial::new
. - Error type returned from
Cauchy::new
. - Error type returned from
ChiSquared::new
andStudentT::new
. - Error type returned from
Dirichlet::new
. - Error type returned from
Exp::new
. - Error type returned from
FisherF::new
. - Error type returned from
Frechet::new
. - Error type returned from
Gamma::new
. - Error type returned from
Geometric::new
. - Error type returned from
Gumbel::new
. - Error type returned from
Hypergeometric::new
. - Error type returned from
InverseGaussian::new
- Error type returned from
Normal::new
andLogNormal::new
. - Error type returned from
NormalInverseGaussian::new
- Error type returned from
Pareto::new
. - Error type returned from
Pert
constructors. - Error type returned from
Poisson::new
. - Error type returned from
SkewNormal::new
. - Error type returned from
Triangular::new
. - Error type returned from
Weibull::new
. - Errors returned by
WeightedIndex::new
,WeightedIndex::update_weights
and other weighted distributions - Error type returned from
Zeta::new
. - Error type returned from
Zipf::new
.
Traits§
- Types (distributions) that can be used to create a random instance of
T
.