I am having trouble getting the code below to do what i want. I need the code to randomly generate a number between 0 and 45, if the number is between 0 and 45 it will place it in the array. But how do I make it generate another number if the one before it is not between 0 and 45???
Cheers,Rik
int Game1 [] = new int [1000];
for(int counter = 0; counter < 1000 ; counter ++)
{
int num = (int)(Math.random()*100);
if((num > 0) && (num <= 45))
{
Game1[counter] = num;
}
}