delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/01/04:07:44

Sender: nate AT cartsys DOT com
Message-ID: <37A3D14C.A90398BE@cartsys.com>
Date: Sat, 31 Jul 1999 21:47:08 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: how about "more" random ? SPEED???
References: <199907311044 DOT GAA17866 AT delorie DOT com>
Reply-To: djgpp AT delorie DOT com

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? 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?

I rather doubt you'll find a much faster rand without losing a lot of
quality.  The only thing expensive seems to be three multiplications (at
asm level) and even those are quite fast on many modern processors.

It's usually best to determine for yourself whether performance problems
exist.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019