Continuous Distributions¶
|
API
|
Classes | |
| class | cExponential |
| Generates random numbers from the exponential distribution. More... | |
| class | cNormal |
| Generates random numbers from the normal distribution. More... | |
| class | cTruncNormal |
| Generates random numbers from the truncated normal distribution. More... | |
| class | cGamma |
| Generates random numbers from the gamma distribution. More... | |
| class | cBeta |
| Generates random numbers from the beta distribution. More... | |
| class | cErlang |
| Generates random numbers from the Erlang distribution. More... | |
| class | cChiSquare |
| Generates random numbers from the chi-square distribution. More... | |
| class | cStudentT |
| Generates random numbers from Student's T distribution. More... | |
| class | cCauchy |
| Generates random numbers from the Cauchy distribution. More... | |
| class | cTriang |
| Generates random numbers from the triangular distribution. More... | |
| class | cWeibull |
| Generates random numbers from the Weibull distribution. More... | |
| class | cParetoShifted |
| Generates random numbers from the shifted Pareto distribution. More... | |
Functions | |
| SIM_API double | uniform (cRNG *rng, double a, double b) |
| Returns a random variate with uniform distribution in the range [a,b). | |
| SimTime | uniform (cRNG *rng, SimTime a, SimTime b) |
| SimTime version of uniform(cRNG*,double,double), for convenience. | |
| SIM_API double | exponential (cRNG *rng, double mean) |
| Returns a random variate from the exponential distribution with the given mean (that is, with parameter lambda=1/mean). | |
| SimTime | exponential (cRNG *rng, SimTime mean) |
| SimTime version of exponential(cRNG*,double), for convenience. | |
| SIM_API double | normal (cRNG *rng, double mean, double stddev) |
| Returns a random variate from the normal distribution with the given mean and standard deviation. | |
| SimTime | normal (cRNG *rng, SimTime mean, SimTime stddev) |
| SimTime version of normal(cRNG*,double,double), for convenience. | |
| SIM_API double | truncnormal (cRNG *rng, double mean, double stddev) |
| Normal distribution truncated to nonnegative values. | |
| SimTime | truncnormal (cRNG *rng, SimTime mean, SimTime stddev) |
| SimTime version of truncnormal(cRNG*,double,double), for convenience. | |
| SIM_API double | gamma_d (cRNG *rng, double alpha, double theta) |
| Returns a random variate from the gamma distribution with parameters alpha>0, theta>0. Alpha is known as the "shape" parameter, and theta as the "scale" parameter. | |
| SIM_API double | beta (cRNG *rng, double alpha1, double alpha2) |
| Returns a random variate from the beta distribution with parameters alpha1, alpha2. | |
| SIM_API double | erlang_k (cRNG *rng, unsigned int k, double mean) |
| Returns a random variate from the Erlang distribution with k phases and mean mean. | |
| SIM_API double | chi_square (cRNG *rng, unsigned int k) |
| Returns a random variate from the chi-square distribution with k degrees of freedom. | |
| SIM_API double | student_t (cRNG *rng, unsigned int i) |
| Returns a random variate from the student-t distribution with i degrees of freedom. If Y1 has a normal distribution and Y2 has a chi-square distribution with k degrees of freedom then X = Y1 / sqrt(Y2/k) has a student-t distribution with k degrees of freedom. | |
| SIM_API double | cauchy (cRNG *rng, double a, double b) |
| Returns a random variate from the Cauchy distribution (also called Lorentzian distribution) with parameters a,b where b>0. | |
| SIM_API double | triang (cRNG *rng, double a, double b, double c) |
| Returns a random variate from the triangular distribution with parameters a <= b <= c. | |
| double | lognormal (cRNG *rng, double m, double w) |
| Returns a random variate from the lognormal distribution with "scale" parameter m and "shape" parameter w. m and w correspond to the parameters of the underlying normal distribution (m: mean, w: standard deviation.) | |
| SIM_API double | weibull (cRNG *rng, double a, double b) |
| Returns a random variate from the Weibull distribution with parameters a, b > 0, where a is the "scale" parameter and b is the "shape" parameter. Sometimes Weibull is given with alpha and beta parameters, then alpha=b and beta=a. | |
| SIM_API double | pareto_shifted (cRNG *rng, double a, double b, double c) |
| Returns a random variate from the shifted generalized Pareto distribution. | |
Description
Random variate generators for continuous distributions.
Function Documentation
◆ uniform() [1/2]
| SIM_API double uniform | ( | cRNG * | rng, |
| double | a, | ||
| double | b ) |
Returns a random variate with uniform distribution in the range [a,b).
- Parameters
-
a,b the interval, a<b rng the underlying random number generator
Referenced by cComponent::uniform(), and uniform().
◆ uniform() [2/2]
SimTime version of uniform(cRNG*,double,double), for convenience.
References SimTime::dbl(), and uniform().
◆ exponential() [1/2]
| SIM_API double exponential | ( | cRNG * | rng, |
| double | mean ) |
Returns a random variate from the exponential distribution with the given mean (that is, with parameter lambda=1/mean).
- Parameters
-
mean mean value rng the underlying random number generator
Referenced by cComponent::exponential(), and exponential().
◆ exponential() [2/2]
SimTime version of exponential(cRNG*,double), for convenience.
References SimTime::dbl(), and exponential().
◆ normal() [1/2]
| SIM_API double normal | ( | cRNG * | rng, |
| double | mean, | ||
| double | stddev ) |
Returns a random variate from the normal distribution with the given mean and standard deviation.
- Parameters
-
mean mean of the normal distribution stddev standard deviation of the normal distribution rng the underlying random number generator
Referenced by lognormal(), cComponent::normal(), and normal().
◆ normal() [2/2]
SimTime version of normal(cRNG*,double,double), for convenience.
References SimTime::dbl(), and normal().
◆ truncnormal() [1/2]
| SIM_API double truncnormal | ( | cRNG * | rng, |
| double | mean, | ||
| double | stddev ) |
Normal distribution truncated to nonnegative values.
It is implemented with a loop that discards negative values until a nonnegative one comes. This means that the execution time is not bounded: a large negative mean with much smaller stddev is likely to result in a large number of iterations.
The mean and stddev parameters serve as parameters to the normal distribution before truncation. The actual random variate returned will have a different mean and standard deviation.
- Parameters
-
mean mean of the normal distribution stddev standard deviation of the normal distribution rng the underlying random number generator
Referenced by cComponent::truncnormal(), and truncnormal().
◆ truncnormal() [2/2]
SimTime version of truncnormal(cRNG*,double,double), for convenience.
References SimTime::dbl(), and truncnormal().
◆ gamma_d()
| SIM_API double gamma_d | ( | cRNG * | rng, |
| double | alpha, | ||
| double | theta ) |
Returns a random variate from the gamma distribution with parameters alpha>0, theta>0. Alpha is known as the "shape" parameter, and theta as the "scale" parameter.
Some sources in the literature use the inverse scale parameter beta = 1 / theta, called the "rate" parameter. Various other notations can be found in the literature; our usage of (alpha,theta) is consistent with Wikipedia and Mathematica (Wolfram Research).
Gamma is the generalization of the Erlang distribution for non-integer k values, which becomes the alpha parameter. The chi-square distribution is a special case of the gamma distribution.
For alpha=1, Gamma becomes the exponential distribution with mean=theta.
The mean of this distribution is alpha*theta, and variance is alpha*theta2.
Generation: if alpha=1, it is generated as exponential(theta).
For alpha>1, we make use of the acceptance-rejection method in "A Simple Method for Generating Gamma Variables", George Marsaglia and Wai Wan Tsang, ACM Transactions on Mathematical Software, Vol. 26, No. 3, September 2000.
The alpha<1 case makes use of the alpha>1 algorithm, as suggested by the above paper.
- Remarks
- the name gamma_d is chosen to avoid ambiguity with a function of the same name
- Parameters
-
alpha >0 the "shape" parameter theta >0 the "scale" parameter rng the underlying random number generator
Referenced by cComponent::gamma_d().
◆ beta()
| SIM_API double beta | ( | cRNG * | rng, |
| double | alpha1, | ||
| double | alpha2 ) |
Returns a random variate from the beta distribution with parameters alpha1, alpha2.
Generation is using relationship to Gamma distribution: if Y1 has gamma distribution with alpha=alpha1 and beta=1 and Y2 has gamma distribution with alpha=alpha2 and beta=2, then Y = Y1/(Y1+Y2) has beta distribution with parameters alpha1 and alpha2.
- Parameters
-
alpha1,alpha2 >0 rng the underlying random number generator
Referenced by cComponent::beta().
◆ erlang_k()
| SIM_API double erlang_k | ( | cRNG * | rng, |
| unsigned int | k, | ||
| double | mean ) |
Returns a random variate from the Erlang distribution with k phases and mean mean.
This is the sum of k mutually independent random variables, each with exponential distribution. Thus, the kth arrival time in the Poisson process follows the Erlang distribution.
Erlang with parameters m and k is gamma-distributed with alpha=k and beta=m/k.
Generation makes use of the fact that exponential distributions sum up to Erlang.
- Parameters
-
k number of phases, k>0 mean >0 rng the underlying random number generator
Referenced by cComponent::erlang_k().
◆ chi_square()
| SIM_API double chi_square | ( | cRNG * | rng, |
| unsigned int | k ) |
Returns a random variate from the chi-square distribution with k degrees of freedom.
The chi-square distribution arises in statistics. If Yi are k independent random variates from the normal distribution with unit variance, then the sum-of-squares (sum(Yi^2)) has a chi-square distribution with k degrees of freedom.
The expected value of this distribution is k. Chi_square with parameter k is gamma-distributed with alpha=k/2, beta=2.
Generation is using relationship to gamma distribution.
- Parameters
-
k degrees of freedom, k>0 rng the underlying random number generator
Referenced by cComponent::chi_square().
◆ student_t()
| SIM_API double student_t | ( | cRNG * | rng, |
| unsigned int | i ) |
Returns a random variate from the student-t distribution with i degrees of freedom. If Y1 has a normal distribution and Y2 has a chi-square distribution with k degrees of freedom then X = Y1 / sqrt(Y2/k) has a student-t distribution with k degrees of freedom.
Generation is using relationship to gamma and chi-square.
- Parameters
-
i degrees of freedom, i>0 rng the underlying random number generator
Referenced by cComponent::student_t().
◆ cauchy()
| SIM_API double cauchy | ( | cRNG * | rng, |
| double | a, | ||
| double | b ) |
Returns a random variate from the Cauchy distribution (also called Lorentzian distribution) with parameters a,b where b>0.
This is a continuous distribution describing resonance behavior. It also describes the distribution of horizontal distances at which a line segment tilted at a random angle cuts the x-axis.
Generation uses inverse transform.
- Parameters
-
a b b>0 rng the underlying random number generator
Referenced by cComponent::cauchy().
◆ triang()
| SIM_API double triang | ( | cRNG * | rng, |
| double | a, | ||
| double | b, | ||
| double | c ) |
Returns a random variate from the triangular distribution with parameters a <= b <= c.
Generation uses inverse transform.
- Parameters
-
a,b,c a <= b <= c rng the underlying random number generator
Referenced by cComponent::triang().
◆ lognormal()
|
inline |
Returns a random variate from the lognormal distribution with "scale" parameter m and "shape" parameter w. m and w correspond to the parameters of the underlying normal distribution (m: mean, w: standard deviation.)
Generation is using relationship to normal distribution.
- Parameters
-
m "scale" parameter, m>0 w "shape" parameter, w>0 rng the underlying random number generator
References normal().
Referenced by cComponent::lognormal().
◆ weibull()
| SIM_API double weibull | ( | cRNG * | rng, |
| double | a, | ||
| double | b ) |
Returns a random variate from the Weibull distribution with parameters a, b > 0, where a is the "scale" parameter and b is the "shape" parameter. Sometimes Weibull is given with alpha and beta parameters, then alpha=b and beta=a.
The Weibull distribution gives the distribution of lifetimes of objects. It was originally proposed to quantify fatigue data, but it is also used in reliability analysis of systems involving a "weakest link," e.g. in calculating a device's mean time to failure.
When b=1, Weibull(a,b) is exponential with mean a.
Generation uses inverse transform.
- Parameters
-
a the "scale" parameter, a>0 b the "shape" parameter, b>0 rng the underlying random number generator
Referenced by cComponent::weibull().
◆ pareto_shifted()
| SIM_API double pareto_shifted | ( | cRNG * | rng, |
| double | a, | ||
| double | b, | ||
| double | c ) |
Returns a random variate from the shifted generalized Pareto distribution.
Generation uses inverse transform.
- Parameters
-
a,b the usual parameters for generalized Pareto c shift parameter for left-shift rng the underlying random number generator
Referenced by cComponent::pareto_shifted().
Generated on for API by