delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/22/11:39:58

Date: Thu, 22 Jan 1998 18:38:13 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Mirek Prywata <mpry AT fuw DOT edu DOT pl>
cc: djgpp AT delorie DOT com
Subject: Re: random numbers?
In-Reply-To: <34C75981.7A16524A@fuw.edu.pl>
Message-ID: <Pine.SUN.3.91.980122183421.1427F-100000@is>
MIME-Version: 1.0

On Thu, 22 Jan 1998, Mirek Prywata wrote:

> You do not understand or you pretend you don't understand. random() and
> randomize(), etc are only MACROS, which does not belong to ANSI C.

This is only correct for Borland.  In DJGPP and many Unix compilers,
`random' is a function, not a macro, and it uses an entirely different
algorithm.  Please make a point to double-check yourself before posting
such definitive replies. 

> One more thing random() is niether better nor worse than rand() /random
> as a macro using rand/

Wrong again.  `random' uses a different algorithm that makes low-order
bits much more random than what `rand' returns.  For example, random()%3
will yield much more random 2-bit number than rand()%3. 

- Raw text -


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