# How to compare randomness of two sets of data?

Given two sets of random numbers, is it possible to say that one set of random numbers has a greater degree of randomness when compared to the other? Or one set of numbers is more random when compared to the other?

EDIT:

Consider this situation: A hacker needs to know the target address where a heap/library/base of the executable is located. Once he knows the address he can take advantage of it and compromise the system.

Previously, the location was fixed across all computers and so it was easy for the hackers to hack the computer.

There are two software S1 and S2. S1 generates a random number where the heap/library/base of the executable is located. So now, it is difficult for the hacker to predict the location.

Between S1 and S2, both of which have random number generators, which one is better? Can we compare based on the random numbers generated by each software?

There are randomness tests. Some tests are powerful enough that they will distinguish a human-generated sequence of 100 heads and tails from 100 tosses of a coin with high probability. For example, the distribution of streaks tends to change radically if you reverse every other coin in the human-generated sequence, while it stays the same for the coin flips. Some default random number generators in compilers will pass simple tests for randomness while failing more subtle tests.

There are other possible (but I think less likely) interpretations of your question. If you meant something else, such as the deviations of a random variable from the mean, please clarify.

It seems to me that it is not so important that the numbers are random (which I assume they are) but whether the underlying pseudo-random algorithm can be detected. You are using a software RNG, so by definition it is not truly random. I suspect that if you are dealing with 2 good software packages the RNG in each are good, so that continually testing for randomness and testing for statistical significance is not going to help alot, beyond the initial screen. In fact, if you do too much testing you can come up with a false positive. Perhaps additional tests are in order, such as visual pattern generation, which uses us humans to try to pick out sequences in the data that a program simply would not be able to do.

http://www.random.org/analysis/

From your application, it seems a uniform distribution might be desirable. If that is the case, you could test the outputs of $S1$ and $S2$ against a uniform distribution using the Kolmogorov-Smirnov test. If one of the algorithms consistently produces lower p-values, discard that and use the other one.