| www.delorie.com/archives/browse.cgi | search |
| From: | <jfmcginnis95 AT surfbest DOT net> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Help w/ Random # Generator gone crazy. |
| Date: | Wed, 25 Apr 2001 02:47:31 -0400 |
| Organization: | Budget Internet |
| Lines: | 27 |
| Sender: | newservice AT 1cust73 DOT tnt2 DOT greenville DOT sc DOT da DOT uu DOT net |
| Message-ID: | <9c5rea$ek7$1@news.chatlink.com> |
| NNTP-Posting-Host: | 1cust73.tnt2.greenville.sc.da.uu.net |
| X-Trace: | news.chatlink.com 988180746 14983 63.14.171.73 (25 Apr 2001 06:39:06 GMT) |
| X-Complaints-To: | abuse AT chatlink DOT com |
| NNTP-Posting-Date: | 25 Apr 2001 06:39:06 GMT |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.50.4522.1200 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Hi,
I'm using this code to get an array with a user defined number of
elements:
void getScores (int b[], int num)
{
cout << endl;
srand(time(NULL));
for (int i=0; i < num; i++)
b[i] =rand()%100;
}
If I enter 1 through 4 as the number variable for the array it seems to do
fine. When I get a larger number of elements in the array though it will
give me all zeros or huge numbers, positive and negative, that have not
appeared to have gone through the %100 part of the function. Anyone have
any ideas? Please help.
Thanks, JT
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |