Fortran code to test random deviates

Can someone suggest a Fortran code that tests the quality of a stream of uniform random deviates?

1 Like

I see that the late Alan Miller, as usual, had some relevant codes:

DIEHARD A version of George Marsaglia’s random number tests in standard Fortran.

toms519.f90 Kolmogorov-Smirnov probabilities (which can be used to test if a sample has a specified distribution, such as uniform)

Apart from Fortran, there is the BDS test using correlation integrals and CryptRndTest: An R Package for Testing the Cryptographic Randomness.

It really depends on what you want to know: a function like: “random = 0.0001*i, i = i+1, if i > 10000 set i 0” will give perfectly uniformly distributed values between 0 and 1, but is not likely to be acceptable as a pseudorandom number generator.

There are some classic or well-known articles about the way some PRNGs are not acceptable. Here is one by George Marsaglia: https://www.pnas.org/content/pnas/61/1/25.full.pdf

And here are two others: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-22r1a.pdf
[1005.1320] The myth of equidistribution for high-dimensional simulation

TestU01 is a software library, implemented in the ANSI C language, and offering a collection of utilities for the empirical statistical testing of uniform random number generators.

PractRand (Practically Random) is a C++ library of pseudo-random number
generators (PRNGs, or just RNGs) and statistical tests for RNGs.

Some (user-written) resources on how to use them: