views:

223

answers:

7

A good RNG ought to pass several statistical tests of randomness. For example, uniform real values in the range 0 to 1 can be binned into a histogram with roughly equal counts in each bin, give or take some due to statistical fluctuations. These counts obey some distribution, I don't recall offhand if it's Poisson or binomial or what, but in any case these distributions have tails. Same idea applies to tests for correlations, subtle periodicities etc.

A high quality RNG will occasionally fail a statistical test. It is good advice to be suspicious of RNGs that look to perfect.

Well, I'm crazy and would like to generate (reproducibly) "too perfect" random numbers, ones suspiciously lacking in those random fluctuations in statistical measures. Histograms come out too flat, variances of moving-box averages come out too small, correlations suspiciously close to zero, etc. Looking for RNGs that pass all statistical tests too cleanly. What known RNGs are like this? Is there published research on this idea?

One unacceptable answer: some of the poorer linear congruential counter generators have too flat a distribution, but totally flunk most tests of randomness.

Related to this is the generation of random number streams with a known calibrated amount of imperfection. A lump in the distribution is easy - just generate a nonuniform distribution approximating the idea (e.g see http://stackoverflow.com/questions/977354/generating-non-uniform-random-numbers) but what about introducing calibrated amounts of higher order correlations while maintaining a correct, or too perfect, distribution?

+1  A: 

You could try something like:

numbers = [1, 2, 3, 4, 5, 6] * 100
random.shuffle(numbers)

to get a random sequence with a perfect uniform distribution.

dan04
A: 

By definition, a PRNG (pseudorandom number generator) cannot generate truly random numbers. No matter what trick you use to generate your pseudorandom sequence, there exists a test that will expose the trick, by showing the actual nonrandomness.

John R. Strohm
only if you have enough samples. in a good PRNG, you can theoretically make "enough" to be a sufficiently large number that the universe will end before you have sufficient evidence to determine that it's not really random....
mikera
+2  A: 

You can't. If it is flat in one test this will mean failure in another one, since the flatness shows it is not random.

starblue
+2  A: 

Apparently the Mersenne Twister, a commonly used random number generator, fails the DieHarder tests by being "too random". In other words, certain tests consistently come too close to their expected value under true randomness.

dsimcha
That's a good example of what I'm looking for.
DarenW
+1  A: 

I think what you're looking for may be a quasi-random sequence. A quasi-random sequence jitters around but in a self-avoiding way, not clumping as much as a random sequence. When you look at how many points fall in different bins, the distribution will work out "too well" compared to a random sequence.

Also, this article may be relevant: When people ask for a random sequence, they’re often disappointed with what they get.

John D. Cook
A: 

The folks at the National Institutes of Standards and Technology Computer Security Division have an abiding interest in RNGs and being able to measure the degree of randomness. I found this while looking for the old DIEHARD suite of PRNG tests.

The folks at the National Security Agency have an abiding interest in RNGs also, but they aren't going to tell you much.

msw
+1  A: 

If you wish to generate a set of random numbers while tied to a set a correlation, you may want to investigate the Cholesky decomposition. I suspect from there you would just need a simple transformation to generate your "too perfect" random numbers.

ast4
What's cholesky got to do with random numbers?
Karl
Let's say you have 2 sets of randomly generated numbers you wish to have a certain correlation. First, you define the covariance matrix you wish to have your numbers coming from (this is will be a 2 x 2 matrix). Then, you perform a Cholesky decomposition on your covariance matrix. You can place these 2 sets (say generated from a Gaussian distribution) in a n x 2 matrix. Multiply your generated numbers through the covariance matrix which you performed the decomposition on.
ast4
Interesting - I would not have thought of this.
DarenW