From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: rand and random Organization: Pin Eight Software Message-ID: References: X-Newsreader: Forte Agent 1.6/32.525 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 27 X-Trace: /K49oFxE8MoBjfDLUiwoE766Lp9hCIUVt46TDvxZ0/JSt95EOyXH+rTDcgz1gRRsfgHRhGTyUas9!S3zKvZAxcE8g5B0xmNZyJUL5u41JukzLObH8d8ZDodz9cs9jHapupNXWHRWXN2+0Bg== X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Tue, 02 Nov 1999 06:51:04 GMT Distribution: world Date: Tue, 02 Nov 1999 06:51:05 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sun, 31 Oct 1999 10:08:42 +0200, Eli Zaretskii wrote: > On Sun, 31 Oct 1999, Damian Yerrick wrote: > > > rand() will give a number between 0 and 32,767. > > Not true; please try to check your advice before posting. > > `rand' returns a random integer between 0 and RAND_MAX. The latter is > defined on stdlib.h, and is much larger than 32K. I thought some C standard defined rand() as #define RAND_MAX 0x7fff int rand(void) { mySeed = (mySeed * 1103515245) + 12345; return (mySeed & 0x7fff0000) >> 16; } Maybe I misunderstood the standard, or maybe the translation (into plain English) was wrong... :-( -- Damian Yerrick Visit my web site: http://yerricde.spedia.net/