I have this code:
public static int MAX;
public static int MIN;
public static void startGame(){
MIN = -1;
MAX = 1;
int[] randomGridVals = new int[ROWS*COLUMNS];
fill(randomGridVals);
System.out.println(Arrays.toString(randomGridVals));
<MORE CODE>
}
private static void fill(int[] randomGridVals) {
for(int i = 0 ; i < randomGridVals.length; i++)
{
int rnd = MIN + (int)(Math.random() * ((MAX - MIN) + 1));
randomGridVals[i] = rnd;
}
}
I expect that the array is passed by reference and the array have random values in it however when I try to print it its empty. Why is this happening ?