Date: Wed, 25 Apr 2001 10:01:14 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: jfmcginnis95 AT surfbest DOT net cc: djgpp AT delorie DOT com Subject: Re: Help w/ Random # Generator gone crazy. In-Reply-To: <9c5rea$ek7$1@news.chatlink.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 25 Apr 2001 jfmcginnis95 AT surfbest DOT net wrote: > 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? An idea: post a short complete program that can be compiled and run. Your code snippet has too many unknowns to see what might go wrong. (For exampe, how is b[] declared in the calling routine? how do you print the resulting array? and so on, and so forth...)