Okay, so essentially, what I want to do is create and print an array of 100 random numbers. My attempts seem to be failing... instead of getting 100 random numbers, I seem to be getting numbers put in order from 0-99. Can someone explain how I can resolve this issue, please? Much appreciated.
public static void enterRandom()
{
System.out.println("Welcome to the random number generator and arranger!");
System.out.println("Now, watch me generate 100 random numbers, and print them in order...");
System.out.println("...");
System.out.println("...");
System.out.println("...");
Random what = new Random ();
int[] store = new int [100];
for (int i = 0; i <= store.length; i++)
{
store[i] = what.nextInt(100); //not in random?
System.out.println(i);
}
return;
}
}
Aucun commentaire:
Enregistrer un commentaire