www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/06/08:31:20

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: rand() or random()
Date: Thu, 06 Nov 1997 09:48:25 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 45
Message-ID: <34618459.EC2FCAEF@LSTM.Ruhr-UNI-Bochum.De>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971105114611 DOT 460F-100000 AT is> <Pine DOT SGI DOT 3 DOT 95L DOT 971106001932 DOT 6835A-100000 AT tower DOT york DOT ac DOT uk>
NNTP-Posting-Host: c64.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John Payne wrote:
> 
> Just out of interest, can anybody find to hand the algorithm that GCC uses
> for random(). I'm doing some work on Genetic Algorithms where a fairly
> decent aproximation of randomness is quite important and it would be nice
> to know that's GCC's random() is decent.
> 
> On Wed, 5 Nov 1997, Eli Zaretskii wrote:
> 
> >
> > This doesn't have to be so.  If we have a good free RNG, we could
> > replace `rand'.  Writing a good RNG is not a trivial matter, but
> > there's a lot of literature on the subject, including algorithms and
> > public-domain code, out there.  It shouldn't take somebody who knows
> > about the subject matter more than a few days of work to come up with
> > a reasonably good version.
> >
> > Any takers?
A real good in terms of randomness algorithm can be found in 
one of the 90's Journal of Computational Physics and is by DEK, 
as far as I recall. I involves floating point ops, so it
is probably slower than what is in libc right now. If there
is real need for it, I can go on digging it out.


If you are looking for other good ones, check 
Numerical Recipes by Press/Flannery/Teukolsky/Vetterling, Cambridge
   Press, UK,
Seminumerical Algorithms, DEK, Addison Wesley


-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


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