It is sometimes desired to test whether a set of generated numbers are random. There are three aspects that we can think about:
Whether the numbers have a uniform distribution so are evenly distributed, perhaps after grouping into intervals. Histograms or stem-and-leaf displays could be sued and a formal test for uniformity via the Kolmogorov-Smirnov test (see EDA Graduate Statistics talk) and is available using the EXPLORE command in SPSS under analyze>descriptive statistics.
- A runs test could also be used to check for the absence of correlations between successive observations. This test counts the number of changes of direction in the series e.g. the sequence 3 5 2 has two runs (3 to 5 and 5 to 2) and compares this number to that expected by chance. This is available using the nonparametric one sample procedure in SPSS. In fact in SPSS 19 the new dialogue box calls the runs test 'Tes of sequence of randomness'
- To guard against a random permutation being repeated (e.g. 132 132) we could also plot the difference in sequence positions between successive observations from the same interval occurring. If the sequence is not being repeated then the difference in sequence positions should be evenly (uniformly) distributed.