News for hackers. Stuff that matters.
Re:Random in the wild by glass- on Tuesday December 09, 2014 @05:05PM (#8726146)
> If you're not using it for cryptographic purposes, then I don't see why it matters. :)

There was a program I was using that used libtommath, and used that library's mp_rand function. libtommath's mp_rand does various trickery but essentially adds two results of rand() together[0].

If you call rand() multiple times on OpenBSD you will get a sequence that alternates between odd and even, which is completely standards compliant. Because of this the result of adding two rand() results together will always be odd (odd + even = odd).

The program didn't need cryptographic levels of randomness, but only returning odd numbers turned out to be a bit of a problem.

[0] https://github.com/libtom/libtommath/blob/develop/bn_mp_rand...

Re:Random in the wild by sarciszewski on Tuesday December 09, 2014 @09:16PM (#8727318)
That's really fascinating! :D