Translation of SimpleRNG.
Removed the builtin RNG to use std.random, but kept the distribution functions.
John D. Cook confirmed this code as public domain.
- Authors
- John D. Cook.
- See Also
- www.johndcook.com/cpp_random_number_generation.html
double randNormal(RNG)(ref RNG rng, double mean = 0.000000, double standardDeviation = 1.00000);
- Returns
- Normal (Gaussian) random sample.
- See Also
- Box-Muller algorithm.
- Returns
- Exponential random sample with specified mean.
double randGamma(RNG)(ref RNG rng, double shape, double scale);
- Returns
- Gamma random sample.
- See Also
- "A Simple Method for Generating Gamma Variables"
by George Marsaglia and Wai Wan Tsang. ACM Transactions on Mathematical Software
Vol 26, No 3, September 2000, pages 363-372.
- Returns
- Chi-square sample.
- Returns
- Inverse-gamma sample.
double randWeibull(RNG)(ref RNG rng, double shape, double scale);
double randCauchy(RNG)(ref RNG rng, double median, double scale);
double randStudentT(RNG)(ref RNG rng, double degreesOfFreedom);
- Returns
- Student-t sample.
- See Also
- Seminumerical Algorithms by Knuth.
double randLaplace(RNG)(ref RNG rng, double mean, double scale);
- Returns
- Laplace distribution random sample (also known as the double exponential distribution).
- Returns
- Log-normal sample.
double randBeta(RNG)(ref RNG rng, double a, double b);