Random Number Generation for QuickCheck

You may encounter problems when using QuickCheck caused by the differing behaviour of random number generation in various Haskell systems. If you observe that QuickCheck is using the same test cases very many times, then this is probably the reason.

Haskell 98 random number libraries are based on a class of random number generators with two methods,

While it is well known how to generate a sequence of pseudo-random numbers from a seed, the split operation is much less well understood. The Haskell standard accordingly only requires that split return two independent generators.

However, QuickCheck assumes a much stronger property of split, namely that all the generators produced by splitting a single seed an arbitrarily large (but not too large) number of times are independent. Thus one can obtain n+1 independent generators by using split n times.

Some distributed implementations of the random number library do not have this property. In particular, some versions of split return the argument as one of the two results. Although this meets the requirements in the standard, it means that splitting a generator n times can produce n identical generators. QuickCheck does not work in this case.

QuickCheck has been developed using Hugs, but it does not work with every version. The November 1999 release of Hugs contains an improved random number library which works well. Older versions are likely to cause problems. So if you have trouble of this sort, download the newest version of Hugs.


Last modified: Fri Jan 28 10:53:10 MET 2000