delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/12/21:27:28

Date: Sun, 12 Oct 1997 18:24:24 -0700 (PDT)
Message-Id: <199710130124.SAA20046@adit.ap.net>
Mime-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Random numbers again...
Cc: Antonio Dias <accdias AT provider DOT com DOT br>, djgpp AT delorie DOT com

At 02:00  10/12/1997 +0200, Eli Zaretskii wrote:
>
>On Thu, 9 Oct 1997, Nate Eldredge wrote:
>
>> rand() and random() both generate random numbers, in fact
>> they are the same code under DJGPP.
>  ^^^^^^^^^^^^^^^^^^^^^^
>Certainly NOT!!  The code of `rand' and `random' is entirely
>different.
>
>Even when `random' operates in its type-zero mode (and uses a linear
>congruental method similar to that of `rand'), it uses different
>constants, so the numbers come out different.
>
>But the default mode of `random' is type-3, whereby it employs the
>linear feedback shift register method.  This is vastly superior to
>`rand'; in particular, the LSBs output by `random' are much more
>random than those produced by `rand'.
Oh. Sorry. Incidentally, which of `random' and `rand' is ANSI? I'm feeling
doubtful about my information on that point as well.
Another question: What is the point of having two different random number
generators when one is much better? 

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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