Date: Sun, 1 Aug 1999 11:56:46 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Dan Gold cc: djgpp AT delorie DOT com Subject: Re: how about "more" random ? SPEED??? In-Reply-To: <199907311044.GAA17866@delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.