From: James McCue Newsgroups: comp.os.msdos.djgpp Subject: Re: rand() problem Date: Wed, 14 Jan 1998 11:47:33 -0500 Organization: Talking to the lampost productions Lines: 32 Message-ID: <34BCEC25.41AF@prodigy.net> References: Reply-To: aloiterer AT juno DOT com NNTP-Posting-Host: port101.emea.prodigy.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 Geoff J. Howard wrote: > #include > #include > > main () > { > int i; > > for (i=1; i<= 20; i++) { > printf("%10d", 1 + (rand() % 6)); > > if (i % 5 == 0) > printf("\n"); > } > > return 0; > } You have to "seed" the random number generator Use srand( <- put something in here -> ); before the loop... prior to using DJGPP myself, I would use the value of my timer as the seed... I'd appreciate seeing how that would work in DJGPP Jim the loiterer http://members.xoom.com/JimMcCue/index.htm I love you all!!