An Introduction to Numerical Methods in C++, Revised Edition

There is really no way of telling whether a single number is random. Is zero random? One can hope only to say whether a sequence of numbers satisfies one or more well accepted tests of randomness. It is obviously important to test whether any particular sequence satisfies appropriate tests, or (more to the point) whether any particular sequence generator actually generates sequences which satisfy such tests.
We cannot go into all the intricacies of statistical testing. They are fully described elsewhere. But it is perhaps worthwhile to explain the basis of the more important methods. Many of them are based upon the ? 2 test, so called. For the sake of definiteness let us consider the throwing of a pair of dice. The scores can be 2 up to 12, but whereas there is only one way of getting 2 or 12, there are several ways of getting other scores. If the dice are unloaded, the probability of any particular pair of faces turning up is 1/36. There is 1 way of scoring 2, 2 ways of scoring 3, and so on; the probabilities p s of the various scores s are therefore:
| s | = | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| p s | = | 1/36 | 1/18 | 1/12 | 1/9 | 5/36 | 1/6 | 5/36 | 1/9 | 1/12 | 1/18 | 1/36 |
Now suppose we throw the dice n = 144 (= 36 4) times, and record the number of times a given score