Post Reply 
Information on calculator Random Number Generators from PPC Journal articles
11-14-2016, 07:45 PM (This post was last modified: 11-14-2016 07:48 PM by Dieter.)
Post: #34
RE: Information on calculator Random Number Generators from PPC Journal articles
(11-14-2016 01:09 AM)Namir Wrote:  Sorry, I don't have time to do a 100 run. I don't doubt you results since 5 runs is below the minimum of 30 to begin to approach normal distribution.

In the meantime I've read a few papers on testing RNGs and found an interesting quote from Donald E. Knuth's well known book "The Art of Computer Programming" where a chapter deals with random number generation and testing. I do not own this book, but he seems to suggest the following way of evaluating the Chi² value obtained after a run with, say, 10.000 of random numbers that are grouped in, say, ten categories to check their distribution in the [0;1[ domain. According to Knuth both very high and very low Chi² values are critical:
  • If the Chi² value is below the 1% quantile or above the 99% quantile, the tested sample can be considered "non-random".
  • If the Chi² value is between the 1% and 5% quantiles or between the 95% and 99% quantiles, the sample should be considered "suspect".
  • If the Chi² value is between the 5% and 10% quantiles or between the 90% and 95% quantiles, the sample is considered "almost suspect".
In a way this sounds logical. Consider a die that is rolled 60 times and it comes out to exactly ten ones, ten twos etc., This would yield a Chi² value of zero and thus qualify the die as "non-random".

If a run with 10.000 random numbers is grouped into ten categories (0...0,1; 0,1...0,2; 0,2...0,3; ..., 0,9...1) the critical Chi² values for 9 degrees of freedom are:

Code:
 1%: 2,088   99%: 21,666  ("non-random")
 5%: 3,325   95%: 16,919  ("suspect")
10%: 4,168   90%: 14,684  ("almost suspect")

So let's say that for ten categories the Chi² value should fall somewhere between 4 and 15 (that's 9%/91%), or at least between 3 and 18 (3,5%/96,4%).

I did a few tests with the 9821 generator and a number of runs with 10.000 random numbers each. In most cases the Chi² value was well within the mentioned limits. Only sometimes especially the lower limit was not quite met, i.e. the numbers were a bit "too evenly distributed". The (x+pi)^3 and (x+pi)^5 RNGs were no match in this regard.

Additional tests with 20 and finally 100 categories showed essentially the same the results.

What do the math experts say?

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Information on calculator Random Number Generators from PPC Journal articles - Dieter - 11-14-2016 07:45 PM



User(s) browsing this thread: 3 Guest(s)