vendredi 4 décembre 2015

How do I format an array with 1000 random numbers from 10-99?

This works to print the numbers on one line, but I want to format the array so that there are 20 numbers per row. How would I go about doing this?

Random r = new Random();

int[] myArray = new int[1000];        
for (int counter = 0; counter < myArray.length; counter++) {
    int store = 10 + r.nextInt(89);
    myArray[counter] = store;
    System.out.print(myArray[counter]);
}




Aucun commentaire:

Enregistrer un commentaire