Xref: news2.mv.net comp.os.msdos.djgpp:8012 From: Francisco Javier Pena Pareja Newsgroups: comp.os.msdos.djgpp Subject: Re: random() and rand() question Date: Thu, 29 Aug 1996 09:58:44 +0200 Organization: Centro Informatico Cientifico de Andalucia Lines: 26 Message-ID: NNTP-Posting-Host: sun630.uco.es Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Wed, 28 Aug 1996, J.J. Pierson wrote: > Silly question... How would I go about getting a random number from say 1 > to a specified number? > It's quite simple. Let's suppose you want to get a random number from 0 to 255. Then: rand()%256 will do that. From 1 to 255? rand()%255 + 1 UTOPIAN/Virtual Fantasies