Package org.apache.commons.rng.sampling.distribution
package org.apache.commons.rng.sampling.distribution
This package contains classes for sampling from statistical distributions.
As of version 1.0, the code for specific distributions was adapted from
the corresponding classes in the development version of "Commons Math" (in
package org.apache.commons.math4.distribution
).
When no specific algorithm is provided, one can still sample from any distribution, using the inverse method, as illustrated in:
Algorithms are described in e.g. Luc Devroye (1986), chapter 9 and chapter 10. This paper discusses Gaussian generators.
-
ClassDescriptionSampling from an exponential distribution.Sampling from the gamma distribution.Class to sample from the Gamma distribution when
0 < alpha < 1
.Base class for a sampler from the Gamma distribution.Class to sample from the Gamma distribution when thealpha >= 1
.Distribution sampler that uses the Alias method.Sample from the computed tables exploiting the small power-of-two table size.Deprecated.Since version 1.1.Deprecated.Since version 1.1.Box-Muller algorithm for sampling from Gaussian distribution with mean 0 and standard deviation 1.Sampling from a beta distribution.Base class to implement Cheng's algorithms for the beta distribution.Computes one sample using Cheng's BB algorithm, when beta distributionalpha
andbeta
shape parameters are both larger than 1.Computes one sample using Cheng's BC algorithm, when at least one of beta distributionalpha
orbeta
shape parameters is smaller than 1.Interface for a continuous distribution that can be sampled using the inversion method.Sampler that generates values of typedouble
.Sampling from a uniform distribution.Specialization to sample from an open interval(lo, hi)
.Sampling from a Dirichlet distribution.Sample from a Dirichlet distribution with different concentration parameters for each category.Sample from a symmetric Dirichlet distribution with the same concentration parameter for each category.Interface for a discrete distribution that can be sampled using the inversion method.Sampler that generates values of typeint
.Discrete uniform distribution sampler.Base class for a sampler from a discrete uniform distribution.Discrete uniform distribution sampler when the sample value is fixed.Discrete uniform distribution sampler when the range between lower and upper is too large to fit in a positive integer.Adds an offset to an underlying discrete sampler.Discrete uniform distribution sampler when the range is a power of 2 and greater than 1.Discrete uniform distribution sampler when the range is small enough to fit in a positive integer.Distribution sampler that uses the Fast Loaded Dice Roller (FLDR).Class to handle the edge case of observations in only one category.Class to implement the FLDR sample algorithm.Sampling from a Gaussian distribution with given mean and standard deviation.Sampling from a geometric distribution.Sample from the geometric distribution by using a related exponential distribution.Sample from the geometric distribution when the probability of success is 1.Compute a sample fromn
values each with an associated probability.Adapted and stripped down copy of class"org.apache.commons.math4.special.Gamma"
.Functions used by some of the samplers.Class for computing the natural logarithm of the factorial ofn
.Distribution sampler that uses the inversion method.Distribution sampler that uses the inversion method.Sampling from a Pareto distribution.Sampler for the Poisson distribution.Sampler for the Poisson distribution.Encapsulate the state of the sampler.Sampling from a Lévy distribution.Sampling from a log-normal distribution.Sampler that generates values of typelong
.Marsaglia polar method for sampling from a Gaussian distribution with mean 0 and standard deviation 1.Sampler for a discrete distribution using an optimised look-up table.The base class for Marsaglia-Tsang-Wang samplers.Create a sampler for the Binomial distribution.Return a fixed result for the Binomial distribution.Return an inversion result for the Binomial distribution.Create a sampler for an enumerated distribution ofn
values each with an associated probability.An implementation for the sample algorithm based on the decomposition of the index in the range[0,2^30)
into 5 base-64 digits with 16-bit backing storage.An implementation for the sample algorithm based on the decomposition of the index in the range[0,2^30)
into 5 base-64 digits with 32-bit backing storage.An implementation for the sample algorithm based on the decomposition of the index in the range[0,2^30)
into 5 base-64 digits with 8-bit backing storage.Create a sampler for the Poisson distribution.Marker interface for a sampler that generates values from an N(0,1) Gaussian distribution.Sampler for the Poisson distribution.Create a sampler for the Poisson distribution using a cache to minimise construction cost.Implementation of the Zipf distribution.Implements the rejection-inversion method for the Zipf distribution.Deprecated.Since version 1.1.Sampler that generates values of typedouble
and can create new instances to sample from the same state with a given source of randomness.Sampler that generates values of typeint
and can create new instances to sample from the same state with a given source of randomness.Sampler that generates values of typelong
and can create new instances to sample from the same state with a given source of randomness.Sampler for the Poisson distribution.Samples from a stable distribution.Implement the stable distribution case:alpha == 1
andbeta != 0
.Base class for implementations of a stable distribution that requires an exponential random deviate.Implement the generic stable distribution case:alpha < 2
andbeta == 0
.Implement the generic stable distribution case:alpha < 2
andbeta == 0
.Implement thealpha = 1
andbeta = 0
stable distribution case (Cauchy distribution).Implement the generic stable distribution case:alpha < 2
andbeta != 0
.Implement thealpha = 2
stable distribution case (Gaussian distribution).Implement thealpha = 0.5
andbeta = 1
stable distribution case (Levy distribution).Implement special math functions required by the CMS algorithm.Class for implementations of a stable distribution transformed by scale and location.Implement the generic stable distribution case:alpha < 2
andbeta != 0
.Sampling from a T distribution.Sample from a t-distribution using a normal distribution.Sample from a t-distribution using Bailey's algorithm.Discrete uniform distribution sampler generating values of typelong
.Discrete uniform distribution sampler when the sample value is fixed.Discrete uniform distribution sampler when the range between lower and upper is too large to fit in a positive long.Adds an offset to an underlying discrete sampler.Discrete uniform distribution sampler when the range is a power of 2 and greater than 1.Discrete uniform distribution sampler when the range is small enough to fit in a positive long.Marsaglia and Tsang "Ziggurat" method for sampling from a Gaussian distribution with mean 0 and standard deviation 1.Modified ziggurat method for sampling from Gaussian and exponential distributions.Modified ziggurat method for sampling from an exponential distribution.Specialisation which multiplies the standard exponential result by a specified mean.Modified ziggurat method for sampling from a Gaussian distribution with mean 0 and standard deviation 1.