A C++ Random Number Generator Class


About:

The code on this page provides a high-quality, fast, and easy-to-use C++ random number generator class that generates random variates for several common distributions. If you are interested in distributions other than what are included in this class, I recommend the random number generators available in other projects such as the Gnu Scientific Library or in the C interface to the R Project for Statistical Computing. If you only need to work with the distributions listed below, you may find this code useful.

The RNG class has member functions that generate random numbers from the following distributions:

The algorithms are, to my knowledge, among the best available in terms of both quality and speed.

Warning My original intention was for this class to support a single instance of the random number generator class on a platform with 32 bit ints. Some attempts have been made to support 64 bit ints and multiple instances of the class, but they are not well tested. Considering I occasionally get bug reports, there may still be some issues. In addition, this class was not designed with multi-threaded applications in mind and has few known issues (race conditions) that could cause problems with them.


Files and Documents:


Changes:



Return to my projects page.