Mail Archives: djgpp/1998/06/10/22:04:13
From: | Kevin Ashley <k DOT ashley AT ulcc DOT ac DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Random functions
|
Date: | Wed, 10 Jun 1998 19:30:13 +0100
|
Organization: | Posted via ULCC Internet Services
|
Lines: | 28
|
Message-ID: | <357ED0B5.41C6@ulcc.ac.uk>
|
References: | <01bd9005$b3927cc0$575995c1 AT nicland>
|
NNTP-Posting-Host: | silver.ulcc.ac.uk
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Nicholas Law wrote:
> I've downloaded some C source code off the internet. It uses the
> (apparently) standard C functions srand48() and lrand48(). When I compile
> the program in djgpp the compiler complains about the functions.
They aren't standard (although on many Unix SYSV functions you get them
when you include stdlib.h). They're part of the Unix SYSV library -
a proprietary 'standard'.
If the program only uses these functions, you can, in most cases,
simply #define them to be srandom() and random(). The calling sequences
and returned values are the same modulo whatever. (srandom() and
srand48()
both take an unsigned int as a seed; lrand48() and random() both return
a positive long int, extending over the whole valid range, as a result.)
The RNGs are very different, though. If the program is something which
is
truly sensitive to the nature of the RNG used, it probably shouldn't be
using these functions anyway.
-----------------------------------------------------------------------
Kevin Ashley K DOT Ashley AT Ulcc DOT ac DOT uk
Special Projects Manager
http://www.ulcc.ac.uk/staff/Kevin+Ashley
ULCC ...ukc!ncdlab!K.Ashley (but probably not any
more)
This is not a signature
- Raw text -