News for hackers. Stuff that matters.
Re:Race Conditions == Random Number Generation by breathoftea on Friday June 27, 2014 @12:31AM (#7952742)
generator.c:

    // For each byte in the buffer, use its value to index into another
    // byte and XOR the two.
This seems to be the only mixing that happens in the entire algorithm, after the initial rand seeding.

I'm not a cryptographer, but this smells extremely insecure to me. If the random seed is all zeroes this generator will generate all zeroes for perpetuity, no?

Even if you get a decent initial seed, I still strongly suspect this RNG strategy will be very statistically leaky, will tend to equilibria, and will generally be easily breakable in practice. An RGB visualization in the context of RNG means next to nothing.

Please children, don't do your own crypto.

Re:Race Conditions == Random Number Generation by mcross on Friday June 27, 2014 @12:37AM (#7952755)
It also uses 100% CPU until the threads are stopped. The author did not make any claims that it was cryptographically secure. It's just a toy that he shared - an interesting way to perhaps generate something useful from something that is normally undesirable.
Re:Race Conditions == Random Number Generation by dasmithii on Friday June 27, 2014 @01:41AM (#7952851)
I suppose the 100% CPU is (very) unnecessary.

Maybe I'll include a variable sleeping time determined by current buffer values. That way, thread synchronization would be further disorganized, and CPU power wouldn't be wasted quite as much.

In that case, it's important that mutations take place between every byte outputted tough.

Re:Race Conditions == Random Number Generation by nathan7 on Friday June 27, 2014 @12:44AM (#7952763)
The visualisation means next to nothing for proving it's good. But the visualisation seems to show patterns, which says plenty.
Re:Race Conditions == Random Number Generation by LnxPrgr3 on Friday June 27, 2014 @03:49AM (#7953097)
If I look at it too long, I see "patterns" in the output of OS X's /dev/random too: http://codeanarchy.com/files/yarrow.png

Random doesn't always look random. To make matters worse, we're biased towards seeing patterns in noise: http://en.wikipedia.org/wiki/Clustering_illusion

Re:Race Conditions == Random Number Generation by praptak on Friday June 27, 2014 @04:29AM (#7953171)
...and my repost from https://news.ycombinator.com/item?id=4821942.

A bookmarklet (paste in address bar) to show truly random and "evened out" dot distributions side by side. (Don't laugh at my Javascript):

javascript:"<html><body><canvas id=\"tutorial\" width=\"200\" height=\"200\">foo</canvas><-><canvas id=\"tutorial2\" width=\"200\" height=\"200\">foo</canvas><script>var canvas = document.getElementById('tutorial');var ctx = canvas.getContext('2d');ctx.fillStyle = \"rgb(000,0,0)\";for (var i=0;i<400;i++) {ctx.fillRect (Math.random() * 200,Math.random() * 200, 2, 2); };</script><script>var canvas = document.getElementById('tutorial2');var ctx = canvas.getContext('2d');ctx.fillStyle = \"rgb(000,0,0)\";for (var i=0;i<20;i++) for(var j=0;j<20;j++) for(k=0;k<1;k++) {ctx.fillRect (i * 10 + Math.random() * 10, j * 10 + Math.random() * 10, 2, 2); };</script></body></html>"

Re:Race Conditions == Random Number Generation by kyberias on Friday June 27, 2014 @06:32AM (#7953418)
"Patterns"? Of course there are patterns. If there were no patterns, that would be suspicious. Do you claim to be able to look at a picture of a random number generator data and determine the quality based on that? You do realize that even perfectly random data may have patterns?
Re:Race Conditions == Random Number Generation by dasmithii on Friday June 27, 2014 @03:43PM (#7955932)
It serves mostly as a litmus test against blatant predictability. As said above, sequential lines or otherwise obvious shapes would indicate poor randomness.

I wouldn't evaluate a generator solely on the basis of a bytemap. But these visualizations are of value.

Re:Race Conditions == Random Number Generation by dasmithii on Friday June 27, 2014 @01:51AM (#7952869)
It seems to be an improvement from the notoriously poor rand() of PHP.

(not confident in the credibility of this article) http://boallen.com/assets/images/randbitmap_computer.png

Re:Race Conditions == Random Number Generation by ars on Friday June 27, 2014 @04:04AM (#7953122)
It's not a PHP function, it's a C library function that PHP is using.

On Linux rand() doesn't suffer from the problem.

Re:Race Conditions == Random Number Generation by DanBC on Friday June 27, 2014 @07:05AM (#7953471)
"Patterns" doesn't mean much. Repeated diagonal lines would be obviously broken.