Live data from Hacker News

Randomly not so random

vanillajava.blogspot.com

11–14 of 14 posts

Re: Randomly not so random

#14
post #4
post #2

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

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

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.

Post reply on HN