delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/06/22:40:41

From: "Marp" <Marp AT 0 DOT 0 DOT 0 DOT 0>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: random numbers
Date: Wed, 6 Jan 1999 22:22:08 -0500
Organization: ICGNetcom
Lines: 7
Message-ID: <771997$n3h@sjx-ixn10.ix.netcom.com>
References: <36940389 DOT 31E6 AT bellsouth DOT net>
NNTP-Posting-Host: prn-nj1-21.ix.netcom.com
X-NETCOM-Date: Wed Jan 06 7:22:15 PM PST 1999
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Use the function rand() in stdlib.h like this:

number = rand()%21;

This will create a (pseudo) random number from 0-20.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019