www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/02/15:33:27

Message-ID: <37052947.42021E95@pacificnet.net>
Date: Fri, 02 Apr 1999 12:32:07 -0800
From: Ralph Gesler <rgesler AT pacificnet DOT net>
X-Mailer: Mozilla 4.5 [en] (Win95; U)
X-Accept-Language: en,ja
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: DJGPP's random functions.
References: <3705018e AT news DOT ismi DOT net> <7e30de$bca$3 AT news DOT luth DOT se>
Reply-To: djgpp AT delorie DOT com

Martin Str|mberg wrote:
> 
> Ike Gingerich (drone AT ismi DOT net) wrote:
> 
> [Klippa, klapp, kluppit original message.]
> 
> Please don't post html-ish.
> 
> Eeeh, how about reading the dokumentation for rand()? There you'll see
> that it is suggested that the PRNG is seeded with a call to srand().
> Additionally it is suggested that the parameter to srand() be based on
> system time.
> 
> Pettersson, Symphony No. 5,
> 
>                                                         MartinS

Ike, FYI. AFIK all software random number generators are really only
pseudo random and require a seed to initialize their operation. This
implies that in a mathematical sense that the generated sequence of
numbers is not completely random (volumes of studies and tests for
randomness have been written) and that any sequence generated from the
same seed will always be the same. I believe that the algorithm used in
the DJGPP function rand() is very good (as I recall someone on this
list, DJ?, discussed this some time ago).

As already pointed out to you, random sequences can be generated by
changing the seed in srand() using time. However, I suggest that until
your code is completely debugged keep the seed constant; you do not need
random bugs.

Ralph Gesler

- Raw text -


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