Message-Id: <199801211711.TAA06183@ankara.duzen.com.tr> Comments: Authenticated sender is From: "S. M. Halloran" Organization: User RFC 822- and 1123-Compliant To: djgpp AT delorie DOT com Date: Wed, 21 Jan 1998 19:11:57 +0200 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: random numbers? CC: mdang AT delorie DOT com In-reply-to: <34C608AE.2569@utc.fr> Precedence: bulk On 21 Jan 98, Van Mo Dang was found to have commented thusly: > I would have two questions about random() and srandom() : > > 1 - Are those routines portables ? I found them both in DJGPP > and on Solaris systems, but can they be considered to be available > in any C standard library ? I don't have any copy of the ANSI C standard and what functions are considered to be part of the library. (Where can that be had?) However, I can say that your functions originated with the Berkeley distribution (even the DJGPP include on the functions mentions it), and so they may be POSIX but not ANSI. The functions rand() and srand() are the equivalents in SVR4 Unix (USL), but I cannot say if they are standard functions; my man page tells me that drand48() and random() are more "elaborate" and produce a better distribution. Newsgroup comp.lang.c probably is the place to look for the final word on portability. > > 2 - Which file should be included to know their prototypes ? On > Solaris, it seems that neither nor contain any > prototype of random() and srandom(). Actually none of the ".h" > files in /usr/include contains their declaration. That's the darnedest thing for me too. Grep on my /usr/include and /usr/include/sys on a system running SVR4 doesn't pull out the prototype for those, even though they are available. I guess you can just set up your own header or put the prototypes at the start of your source in the appropriate location. Don't yank out the DJGPP prototypes and put them in however. Check the man pages on the Solaris and yank them out of there. Mitch Halloran Research (Bio)chemist Duzen Laboratories Group Ankara TURKEY mitch AT duzen DOT com DOT tr other job title: Sequoia's (dob 12-20-95) daddy