On Wed, Feb 2, 2011 at 11:01 PM, Carl Witthoft <c...@witthoft.com> wrote: > Hi, subject more or less says it all. > > I freely admit to not having bothered to find some of the online papers > about method of testing the quality of random number generators -- but in an > idle moment I wondered what to expect from something like the following: > > > randa<-runif(1000) > randb<-runif(1000) > t.test(randa,randb)$p.value > var.test(randa,randb)$p.value > > [repeat ad nauseum] > > > Is the range of p-values I get in any way related tothe "quality" of the > random number generator?
Well yes. All pseudo random number generators have a period, after which they come back to the start and begin churning out the same sequence again. Good PRNGs have a sequence length that is astronomically high. If you have a PRNG that has a sequence of 1000, or 500, or 200 etc your two sets will be perfectly correlated... You might want to read up on RANDU, the infamous poor PRNG: http://en.wikipedia.org/wiki/RANDU “We guarantee that each number is random individually, but we don’t guarantee that more than one of them is random.” The other things to look at are the DieHard tests: http://en.wikipedia.org/wiki/Diehard_test Barry ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.