CleverRaven/Cataclysm-DDA — pull request #3944 by phaethonfire (2013-10-29 05:31:41+00:00)
Title: [WIP] faster random numbers

After reading lots of negative information on how bad the built-in rand() function is, I have swapped in the "fastrand" function that Intel proposed here: http://software.intel.com/en-us/articles/fast-random-number-generator-on-the-intel-pentiumr-4-processor. This should be a nice performance enhancement. On my system, it is about 5x faster at producing pseudo-random numbers. I slightly modified Intel's example to make the random number 2^20 bits long instead of 2^15 too since we don't need 32,768 to be the max.

This PR may actually be ready to go, but I would like a play test by someone to look for any possible bugs. As far as I can tell, world generation is fine, as is gameplay. If this project ever moves to C++11, we can try using Mersenne twister or one of the other new RNGs that come with it. Until then, I think fastrand may be ideal. What do you think?

Oh by the way, the archery json file was missing some commas. I suspect someone else may have fixed that too, but I needed to fix it here to make the game playable.