RandomLib
1.10
|
The exponential distribution. More...
#include <RandomLib/ExponentialDistribution.hpp>
Public Types | |
typedef RealType | result_type |
Public Member Functions | |
template<class Random > | |
RealType | operator() (Random &r, RealType mu=RealType(1)) const throw () |
The exponential distribution.
Sample from the distribution exp(−x/μ) for x ≥ 0. This uses the logarithm method, see Knuth, TAOCP, Vol 2, Sec 3.4.1.D. Example
RealType | the real type of the results (default double). |
Definition at line 37 of file ExponentialDistribution.hpp.
typedef RealType RandomLib::ExponentialDistribution< RealType >::result_type |
The type returned by ExponentialDistribution::operator()(Random&)
Definition at line 42 of file ExponentialDistribution.hpp.
|
inline |
Return a sample of type RealType from the exponential distribution and mean μ. This uses Random::FloatU() which avoids taking log(0) and allows rare large values to be returned. If μ = 1, minimum returned value = 0 with prob 1/2p; maximum returned value = log(2)(p + e) with prob 1/2p + e. Here p is the precision of real type RealType and e is the exponent range.
Random | the type of RandomCanonical generator. |
[in,out] | r | the RandomCanonical generator. |
[in] | mu | the mean value of the exponential distribution (default 1). |
Definition at line 62 of file ExponentialDistribution.hpp.