Emulate MSVC rand() function
Monkey Forums/Monkey Code/Emulate MSVC rand() function
| ||
It seems there are some issues with Rnd() at the moment, and I think a lot of folks would be interested in an integer rand() function anyway. I've made a class that replicates in Monkey the algorithm used by MSVC. Obviously there are better algorithms out there but MSVC is a decent 32-bit LCG that will do the job for most people's gaming purposes. |
| ||
Of course, if you want it exactly like MSVC, you can just use global functions etc. rather than a class. I think I will make those as well, in fact, and keep MSRand for special uses. It's handy to be able to just call rand(). |
| ||
...and into my module of handy functions it goes! |