TAOCP 3.6 Exercise 6

This exercise is not a mathematical problem but a practical programming assignment.

Section 3.6: Summary

Exercise 6. ▶ [**] [40] Look at the subroutine library of each computer installation in your organization, and replace the random number generators by good ones. Try to avoid being too shocked at what you find.

Verified: yes
Solve time: 1m13s


This exercise is not a mathematical problem but a practical programming assignment. The intended solution is to examine the random number generators supplied in the local subroutine libraries, compare them against the criteria summarized in Section 3.6, and replace inadequate generators by generators of known quality.

In particular, linear congruential generators should satisfy the recommendations (i)-(viii), with a large modulus $m$, suitable multiplier $a$, and increment $c$ relatively prime to $m$. Generators that fail statistical tests, have short periods, use poor low-order bits, or exhibit obvious regularities should be retired. For applications requiring very long streams or higher-dimensional accuracy, the lagged Fibonacci method based on equation (2), or the combined generators recommended in Section 3.3.4, should be substituted. The exercise is completed when the installation's random number facilities have been audited and all deficient generators have been replaced by generators meeting the standards developed throughout the chapter. $\boxed{\text{Audit the existing generators and replace all inadequate ones by generators satisfying the criteria of Section 3.6.}}$