faster rand()

2014-12-04 Thread Ted Unangst
After consultation with the C standard, deraadt and I have determined that some speedups can be made the to algorithm used by rand(). Theo initially proposed seed++, but I think seed-- is less expected and therefore makes a better random number generator. Index: rand.c

Re: faster rand()

2014-12-04 Thread Theo de Raadt
After consultation with the C standard, deraadt and I have determined that some speedups can be made the to algorithm used by rand(). Theo initially proposed seed++, but I think seed-- is less expected and therefore makes a better random number generator. Index: rand.c

Re: faster rand()

2014-12-04 Thread Theo de Raadt
Thanks for making my day :) If random() is changed in the same way, the following 1144 packages are possibly impacted. They directly link in rand(), srand(), random() or srandom() from libc. In a few cases, the application calls srandomdev() which then short-cuts random() calls direct to

Re: faster rand()

2014-12-04 Thread Theo de Raadt
The following 81 packages use arc4random from libc. In each case, I am not checking whether the use is due to upstream selecting to use arc4random, or because the ports tree contains a patch. But I suspect most of them are upstream choices. I will not do an analysis for the drand48, erand48,