Thursday, December 31, 2009

I have a set of random numbers generated from a RNG. How can i prove that they are effectively random?

I am looking for answers around periodicity, autocorrelation and independence. The random numbers are generated from a Random Number Generator (RNG) using a Standard normal distribution.I have a set of random numbers generated from a RNG. How can i prove that they are effectively random?
A random number generator is not truly random, unless it uses some sort of hardware process (like the ambient noise from a microphone in a crowded room). Every ';code only'; generator has periodicity, and an algorithm can be found to calculate the (n+1) term in the series, given the first n values.





But the larger your set, the better odds you've got of finding a weakness, and if you don't find anything, the better your RNG is.





Often, RNG's are an iterative process: the nth term in the sequence s(n) = f[s(n-1)] some function of the previous element in the series. So compare s(n-1) to s(n), then compare s(n-2) to s(n), then s(n-3) to n, and so on.





Well-designed RNG's probably won't be that easy to crack. So move along to higher dimesions: compare s(n-1) AND s(n-2) to s(n), then s(n-2) AND s(n-3) to s(n), etc. Then do a 4-dimensional calculation, comparing the previous 3 values to s(n), and so on...





Again, the more data you have, without being able to find a pattern, the better your RNG is.I have a set of random numbers generated from a RNG. How can i prove that they are effectively random?
You need to go back to your RNG and figure out how it is generating the numbers. Also you should probably see if it uses a seed number. If I remember correclty random numbers generated by a computer aren't truely random.





Here's a link to get you started


http://en.wikipedia.org/wiki/Random_numb鈥?/a>
It's not completely random, but if you want to show that it's pretty close to random, just print off like 50 results and see if anyone can find a pattern...
If you're not math-phobic (which I'm guessing you definitely aren't) Knuth Vol. 2 (Seminumerical Algorithms) has a load of good mathematical tests for random number generators. The reference below points to several other sources that may be useful.





Steven Lott has a Python program that runs 11 of Knuth's tests; might need so adaptation, but it's a good starting point.
I would suggest the Kolmolgorov-Smirnov test.





edit: Sorry, I thought you were talking about a uniform distribution. There are better tests for normallity. You can use a normal probability plot to see visually if your data is normal. You can also use the Shapiro-Wilk test. That is probably the best one for determining normality.
The only reasonable test would be to generate thousands of random numbers and graph them. Then you might be able to see if the numbers are random or if patterns appear.

No comments:

Post a Comment