ISO 28640:2010 – Random Variate Generation Methods

Standard methodologies for generating random variates from specified probability distributions for simulation and modeling

Introduction to Standardized Random Variate Generation

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 quality of a simulation depends entirely on the quality of its random inputs. Using poorly implemented or statistically flawed random variate generators can invalidate simulation results even when the system model is perfect. ISO 28640 provides validated reference algorithms that eliminate this source of simulation error.

Core Generation Methods and Algorithms

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
For most engineering simulations, the Box-Muller transform for normal variates combined with inverse-transform methods for other distributions provides an optimal balance of speed and accuracy. The standard recommends this combination as the default implementation approach for general-purpose simulation software.

Validation, Testing, and Implementation Requirements

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.

One common implementation error is using the same uniform random number stream for multiple correlated distributions without proper shuffling. For example, generating both X ~ N(0,1) and Y ~ N(0,1) from the same seed using Box-Muller creates a deterministic pairing that may introduce artificial correlations. The standard recommends using independent random streams or skipping at least 1024 uniform deviates between streams.

Engineering Applications and Simulation Quality

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.

Never use the normal approximation for binomial or Poisson distributions when event rates are low. The approximation error near the tails can exceed 100% at the 99.9th percentile. Use ISO 28640’s exact binomial or Poisson generators instead, which are only marginally slower but provide statistically correct tail behavior essential for reliability and safety analysis.

Algorithm Selection Criteria and Performance Comparison

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.

For most engineering Monte Carlo simulations in tolerance analysis and reliability assessment, a practical rule of thumb is: use Box-Muller for normal variates (fast, adequate tail accuracy for most applications), inverse transform for exponential, Weibull, and lognormal distributions, and the Marsaglia-Tsang method for gamma distributions with α ≥ 1. This combination provides the best overall performance for general-purpose simulation while maintaining adequate accuracy for engineering decision-making.

Implementation Validation and Certification Requirements

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.

A well-documented case illustrates the importance of implementation validation: a major aeronautical engineering firm discovered that their Monte Carlo tolerance simulation, used for 15 years to set manufacturing tolerances on aircraft engine components, had been using a normal distribution generator with incorrect tail behavior due to a single-line coding error. The error caused the generator to under-sample the tails beyond 3 sigma, leading to unrealistically optimistic estimates of manufacturing yield and a systematic 2-3% overestimation of assembly success rates. The error was only discovered during formal ISO 28640 compliance validation, highlighting the practical importance of the standard’s verification requirements.

FAQ

Q: How does ISO 28640 relate to the Mersenne Twister and other PRNGs?
QA: ISO 28640 focuses on transforming uniform random numbers (from any PRNG) into specific distributions. It does not specify the underlying PRNG. The MT19937 Mersenne Twister from IEEE 2600 is commonly used as the uniform source feeding ISO 28640 generators.
Q: Are the recommended algorithms patent-free?
A: Yes, all algorithms cited in the standard (Box-Muller, Marsaglia, Ahrens-Dieter, Cheng’s BB) are in the public domain or covered by expired patents.
Q: Can the standard be used for cryptographic random number generation?
A: No. The pseudo-random numbers generated by these methods are not cryptographically secure. For cryptographic applications, use approved cryptographic random bit generators (ISO 18031).

Leave a Reply

Your email address will not be published. Required fields are marked *