After profiling a large game playing program, I have found that the library function rand() is consuming a considerable fraction of the total processing time. My requirements for the random number generator are not very onerous – its not important that it pass a great battery of statistical tests of pure randomness. I just want something cheap and cheerful that is very fast. Any suggestions?
After profiling a large game playing program, I have found that the library function
Share
There are few algorithms in common use that are faster than an LCG (which is very, very likely what
rand()is using). You may want to try Marsaglia’s Xorshift generator which is pretty fast (depending on the hardware). The WELL512a generator is also quite fast (more so than MT19937 or MT19937-64).