Mail Archives: djgpp/1999/08/01/18:17:25
On Fri, 4 Jan 1980, Dan Gold wrote:
> I was wondering about how fast rand actually executes, Is it something to
> consider when using it alot or is it virtually unnoticable?
It depends on what your program does otherwise.
To get an idea where your program spends most of its time, you should
profile it. DJGPP includes a profiler, see chapter 13 of the DJGPP FAQ
list for more about this. If the profiler shows that the random number
generation takes less than 20% of program's time, it doesn't make much
sense to try to speed up random().
> Is there anyway
> to avoid the multiplications and mods? Is there a better alternative like
> making some kind of randomness look-up-table or something?
Random number generators is a discipline. If you are really interested in
this, begin by reading Knuth's volume that describes random number
generators. You might also search www.dejanews.com for articles posted by
George Marsaglia, who is one of the gurus on this issue.
- Raw text -