From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Random functions Date: Thu, 04 Jun 1998 19:30:16 -0400 Organization: Two pounds of chaos and a pinch of salt. Lines: 29 Message-ID: <35772E08.E9E45409@cs.com> References: <01bd9005$b3927cc0$575995c1 AT nicland> NNTP-Posting-Host: ppp142.cs.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Nicholas Law wrote: > > Hi all! > > 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. These are > my include statements: They aren't standard that I know of. DJGPP includes two random number generators as part of its libc: rand() and random(). The only ANSI-standard RNG is rand(); however, DJGPP's implementation of it lacks randomness in the lower bits. If portability is not an issue, we recommend that random() be used; it contains a complex and apparently rather good algorithm. If portability is an issue, you still should not use rand() because its quality varies greatly from system to system. The best solution for any program that depends on good pseudo-random numbers is to include a custom-designed RNG. For your program to work, you'll have to provide your own versions of srand48() and lrand48(), or use a different RNG. -- --------------------------------------------------------------------- | John M. Aldrich | "Always listen to experts. They'll | | aka Fighteer I | tell you what can't be done, and why.| | mailto:fighteer AT cs DOT com | Then do it." | | http://www.cs.com/fighteer/| - Lazarus Long | ---------------------------------------------------------------------