Newsgroups: comp.ai.genetic
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!howland.reston.ans.net!EU.net!uknet!bcc.ac.uk!daedalus.cs.ucl.ac.uk!charris
From: charris@daedalus.cs.ucl.ac.uk (Chris Harris)
Subject: Re: Random Number Generators
Message-ID: <1995Jul3.112006.38435@ucl.ac.uk>
Date: Mon, 3 Jul 1995 11:20:06 GMT
References:  <3srp7r$2cu@vishnu.jussieu.fr>
Organization: University College London
Lines: 25

In article <3srp7r$2cu@vishnu.jussieu.fr>, okeeffe@ecoledoc.ibp.fr (Brendan OKEEFFE) writes:
> Hi,
> 
> I'm writing a GA in C and was wondering, does anyone know 
> if using 'rand' and 'srand' will introduce any biases into
> a genetic algorithm ?  How does 'rand' generate random
> numbers ?
> 
> Would using another random number generator apart from 'rand'
> be a good idea ?  I think myself that 'rand' is ok, but I would
> appreciate some advice on this.
> 
> Cheers,
> 
> Brendan.

rand and srand are OK if you use some care. It is well known that the lower bits
of the random numbers produced are highly cyclic, so you have to just use the
middle 16 bits (I think). If you're using UNIX, use srand48(),drand48() and
lrand48() instead. These are much better. If you're not, most compilers provide
alternative generators.

Or, there are a lot of other generators out there.

Chris Harris
