cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/02/04:39:02

From: Terence Ramos <de-bug AT ix DOT netcom DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: random numbers error in DJGPP
Date: Sun, 02 Feb 1997 00:04:25 -0800
Organization: Netcom
Lines: 13
Message-ID: <32F44A89.3142@ix.netcom.com>
NNTP-Posting-Host: sjx-ca21-24.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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