#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 () |
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
#include "RandomLib/ExponentialDistribution.hpp" RandomLib::Random r; std::cout << "Seed set to " << r.SeedString() << std::endl; RandomLib::ExponentialDistribution<double> expdist; std::cout << "Select from exponential distribution:"; for (size_t i = 0; i < 10; ++i) std::cout << " " << expdist(r); std::cout << std::endl;
Definition at line 35 of file ExponentialDistribution.hpp.
| typedef RealType RandomLib::ExponentialDistribution< RealType >::result_type |
The type returned by ExponentialDistribution::operator()(Random&)
Definition at line 40 of file ExponentialDistribution.hpp.
| RealType RandomLib::ExponentialDistribution< RealType >::operator() | ( | Random & | r, | |
| RealType | mu = RealType(1) | |||
| ) | const throw () [inline] |
Return a sample of type RealType from the exponential distribution and mean mu. This uses Random::FloatU() which avoids taking log(0) and allows rare large values to be returned. If mu = 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.
Definition at line 55 of file ExponentialDistribution.hpp.
1.5.6