Separating Random Number Generation from Statistical Distributions in C++
Summary
The article presents an object-oriented design for statistical distributions in quantitative finance. It separates uniform random number generation from distribution-specific behavior, allowing a generator to be replaced without changing distribution classes. A common abstract interface covers the probability density and cumulative distribution functions, inverse CDF, mean, variance, standard deviation, and transforming uniform draws into samples.
A standard normal implementation illustrates the design. It approximates the CDF and inverse CDF numerically, using a Beasley-Springer-Moro method for the inverse, and uses Box-Muller to transform paired uniform draws into normal samples. The article shows example output but does not provide a statistical validation study. It notes that some inverse CDFs need numerical approximation and identifies more efficient sampling methods as possible extensions. Its scope is continuous distributions, with other distributions and discrete cases deferred.
Key ideas
- A shared distribution interface can expose density, cumulative probability, quantiles, and descriptive statistics.
- Separating random number sources from distribution transforms makes generators easier to replace and reuse.
- The standard normal example approximates its CDF and inverse CDF numerically.
- Box-Muller converts pairs of uniform draws into standard normal samples.
- The article focuses on interface design and an example, not validation of a production random number system.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.