Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
ISO 28640:2010 addresses a critical foundation of statistical simulation: the generation of random variates from specified probability distributions. While pseudo-random number generation (producing uniform [0,1) deviates) is well covered by standards such as ISO 28640’s companion documents and IEEE 754, transforming uniform deviates into variates following specific distributions requires careful algorithmic implementation. This standard provides validated algorithms for the most commonly used distributions in engineering, finance, and scientific simulation.
The standard defines generation methods for 15 probability distributions. For continuous distributions: uniform, normal (Gaussian), lognormal, exponential, gamma, beta, Weibull, Cauchy, and Student’s t. For discrete distributions: binomial, Poisson, geometric, negative binomial, hypergeometric, and discrete uniform. For each distribution, the standard provides multiple algorithm options with trade-offs between speed and accuracy. The normal distribution, for example, can be generated via the Box-Muller transform (fast, two variates per call), the Marsaglia polar method (rejection-based, ~1.27 variates per call), or the Beasley-Spiegelman algorithm (high-precision CDF inversion).
| Distribution | Preferred Method | Parameters Required | Speed | Accuracy |
|---|---|---|---|---|
| Normal (Gaussian) | Box-Muller transform | μ, σ | Fast (2/output) | Good tails to ±6σ |
| Exponential | Inverse transform: −λ·ln(U) | λ (rate) | Very fast | Exact |
| Gamma (α > 1) | Marsaglia-Tsang method | α, β | Moderate | Excellent |
| Gamma (0 < α < 1) | Ahrens-Dieter algorithm | α, β | Moderate | Good |
| Beta | Cheng’s algorithm (BB) | α, β | Moderate | Good for α,β > 0.5 |
| Binomial | Inversion with tuning | n, p | O(np) or O(log n) | Exact |
| Poisson | Ahrens-Dieter or inversion | λ | O(λ) or O(√λ) | Exact |
ISO 28640 mandates that implementations of random variate generators must pass a suite of statistical tests: the Kolmogorov-Smirnov test for distributional goodness-of-fit at α = 0.05, the Anderson-Darling test (more sensitive to tail discrepancies), and correlation tests (lag-1 and lag-5 autocorrelation) on the generated variates. For streaming applications (e.g., real-time simulation), the standard specifies maximum execution time per variate while maintaining statistical quality. The standard also provides reference output values — specific uniform seeds that should produce known sequences of generated variates — enabling implementers to verify their code against a certified reference implementation.
In engineering practice, ISO 28640 algorithms are used in Monte Carlo simulation for tolerance analysis, reliability prediction, risk assessment, and probabilistic design. For tolerance analysis of mechanical assemblies, normal variates represent dimensional variations, while Weibull variates model component lifetimes in reliability simulation. The standard’s gamma distribution generators are particularly important in queuing simulation and telecommunications traffic modeling. Implementing validated generators per ISO 28640 reduces the risk of simulation artifacts that can arise from poorly designed or ad hoc random variate generators.
ISO 28640 provides multiple algorithm options for each probability distribution, with recommendations based on the trade-offs between computational speed, numerical accuracy (particularly in the distribution tails), memory requirements, and implementation complexity. For the normal distribution, the Box-Muller transform generates two independent normal variates from two uniform variates using the polar-to-Cartesian transformation: Z₁ = √(-2 ln U₁) cos(2πU₂) and Z₂ = √(-2 ln U₁) sin(2πU₂). This method is computationally efficient (approximately 1.5 times faster than the Marsaglia polar method in most implementations) and provides excellent accuracy in the central region (|Z| < 3). However, the Box-Muller tails are only reliable to approximately |Z| = 6 before numerical limitations of the logarithm and cosine functions introduce errors. For applications requiring accurate tail probabilities beyond 6 sigma (such as reliability analysis of safety-critical systems), the standard recommends the Beasley-Spiegelman algorithm for high-precision inverse CDF computation, which maintains relative accuracy of 10⁻¹⁵ in the tails to |Z| = 38. For gamma distribution generation, the Marsaglia-Tsang method (for α ≥ 1) uses a squeeze-and-reject algorithm with acceptance rates exceeding 95%, while the Ahrens-Dieter algorithm for α < 1 uses a composition method combining two different generation strategies. The standard provides performance benchmarks in terms of average number of uniform variates consumed per generated output variate, enabling implementers to estimate computational requirements for large-scale simulation studies.
ISO 28640 requires that any implementation of the specified algorithms pass a comprehensive statistical test suite before being used for production simulation work. The validation requirements include: (1) Distributional goodness-of-fit testing: the Kolmogorov-Smirnov test at α = 0.05 with sample size n = 10,000, and the Anderson-Darling test with the same parameters (more sensitive to tail discrepancies). (2) Moment testing: the sample mean and variance must not differ from the theoretical values by more than ±2σ/√n, where σ is the standard deviation of the respective moment estimator. (3) Autocorrelation testing: lag-1 through lag-10 autocorrelation coefficients must fall within the 95% confidence bounds of ±1.96/√n for independent observations. (4) Chi-square goodness-of-fit test with 20 equiprobable bins for discrete distributions. The standard provides reference implementation code in an annex (informative) and a set of known answer test cases — specific random number seeds paired with expected output values — that enable implementers to verify their code against the approved reference. For quality-critical applications, the standard recommends independent verification of the implementation by a second party, with documented evidence of validation maintained for regulatory review. These validation requirements may seem burdensome, but they protect against subtle implementation errors that can invalidate simulation results — errors that are surprisingly common even in widely used commercial statistical software packages.