The subject of random number generation and testing is reviewed extensively in Knuth’s Seminumerical Algorithms.
Further information is available in the review paper written by Pierre L’Ecuyer,
http://www.iro.umontreal.ca/~lecuyer/papers.html in the file handsim.ps.
The source code for the DIEHARD random number generator tests is also available online,
A comprehensive set of random number generator tests is available from NIST,