
Randomly not so random - dekayed
http://vanillajava.blogspot.com/2011/10/randomly-no-so-random.html
======
ajross
I suspect the blog author knows this, but doesn't say it explicitly and people
might be confused: This isn't an indictment of the RNG.

The test is pulling out 10 integers in the range [0,9]. That space is
log2(10^10) == 33 bits big. The 64 bit seed space is far larger. So for any
given sequence of ten numbers, there are almost certainly going to be many
seeds that will generate it. This has nothing to do with the "quality" of the
generated numbers, it's just that our intuition about what sequences look
"random" lives in a much smaller search space than the RNG can actually
produce.

------
po
The relevant Dilbert comic:

<http://search.dilbert.com/comic/Random%20Number%20Generator>

------
finnw
Only slightly less random than what Java's RNG usually produces:
<http://www.alife.co.uk/nonrandom/>

~~~
ilcavero
replacing Random with SecureRandom solves the problem, though it is 10 times
slower

~~~
SeanLuke
As I understand it, crypto random generators do not have high-grade randomness
as their primary priority. They have _non-predictability_ , even if you know a
large chunk of the previous number stream, as their primary priority.

The right thing to do is to replace Random with a different non-crypto
generator with better properties. (Non-crypto generators don't care about
predictability, only high-grade random distribution). Mersenne Twister seems
the obvious choice, but it's about 1/2 the speed of java.util.Random. There
are some other decent faster generators out there.

------
martinkallstrom
I guess searching for the seeds that would result in a specific string can be
interpreted as a hash function? It takes a long time to find the right seed or
combination of seeds that generate a certain string. Call that a hash value of
the string, then you can reverse the hash by applying it to the randomString()
method.

Could it be possible to use something like this for "quantum compression"? If
you use a quantum computer to find the combinations of seeds that generate a
given string, could that be used for compression?

~~~
caf
No. On average the size of the seeds will be no less than the size of the
original strings.

------
benbeltran
This is nice :) It's an "Infinite monkeys and infinite typewriters" kind of
thing. I like when these sort of patterns emerge in random series.

