www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/02/10:44:15

Date: Sun, 2 Feb 1997 09:31:26 -0600 (CST)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: Terence Ramos <de-bug AT ix DOT netcom DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: random numbers error in DJGPP
In-Reply-To: <32F44A89.3142@ix.netcom.com>
Message-ID: <Pine.SUN.3.95.970202093112.25275B-100000@ernie.eecs.uic.edu>
MIME-Version: 1.0

Try using random() instead of rand()

On Sun, 2 Feb 1997, Terence Ramos wrote:

> Hello...
> 
> I have been having trouble to get DJGPP to give me random numbers.  I am
> using the function rand()... this is how my source looks like
> 
> number = rand() % 100 + 1;
> 
> that should give me a random number from 1 to 100 right?  well i keep on
> getting the same number which is 1.  So i took out the + 1 part and now
> i only get 0.  whats wrong here?  Any help would be appreciated...
> 
> [Terence Ramos       ]
> [de-bug AT ix DOT netcom DOT com]
> 

- Raw text -


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