delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/13/09:22:58

Date: Mon, 13 Oct 1997 15:21:10 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Nate Eldredge <eldredge AT ap DOT net>
cc: Antonio Dias <accdias AT provider DOT com DOT br>, djgpp AT delorie DOT com
Subject: Re: Random numbers again...
In-Reply-To: <199710130124.SAA20046@adit.ap.net>
Message-ID: <Pine.SUN.3.91.971013152009.11407Y-100000@is>
MIME-Version: 1.0

On Sun, 12 Oct 1997, Nate Eldredge wrote:

> Incidentally, which of `random' and `rand' is ANSI?

`rand' is ANSI; `random' is non-ANSI and non-POSIX.

> I'm feeling doubtful about my information on that point as well.

You can easily tell which functions are ANSI and which are POSIX by
looking into the appropriate header that declares their prototype.
Functions whose prototype is BEFORE the #ifndef __STRICT_ANSI__ clause
are ANSI; those between __STRICT_ANSI__ and #ifndef _POSIX_SOURCE are
POSIX; those AFTER _POSIX_SOURCE are neither.  This is so invoking GCC
with -ansi or -posix and -Wall will complain about functions which
don't belong to the relevant standard.

> Another question: What is the point of having two different random number
> generators when one is much better? 

`rand' is ANSI, so you must have it.  You cannot put the code of
`random' inside `rand' because `random's code comes from the BSD
library, which is copyrighted (albeit in public domain), so you cannot
change its name (I think).

- Raw text -


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