Date: Mon, 13 Oct 1997 15:21:10 +0200 (IST) From: Eli Zaretskii To: Nate Eldredge cc: Antonio Dias , djgpp AT delorie DOT com Subject: Re: Random numbers again... In-Reply-To: <199710130124.SAA20046@adit.ap.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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).