Hi, I just profiled my program using gprof, and found out that it spends as much as 60% of it's time in a function which returns a pseudo random number. Now I'm looking for something a lot faster than the regular rand()-approach. I found out about the Mersenne Twister algorithm, which supposedly is a great deal faster than the libc-functions. The main problem is that I don't have a clue on how to make it return a random integer between X and Y, which is crucial for my program. I'd like to be able to do GetRandomNumber(3, 15); to get a pseudo random number between 3 and 15, for example.
The Mersenne Twister is available here:
http://www.math.keio.ac.jp/matumoto/...02/mt19937ar.c
I'd be really grateful for any help possible, because it's a real pain watching 60% of your programs execution time being wasted on random numbers, when it does lots and lots of more important operations in between. Thank you.