[java] Fill an array with random numbers

You can call the randomFill() method in a loop and fill your array in the main() method like this.

public static void main(String args[]) {
    for (int i = 0; i < anArray.length; i++) {
        anArray[i] = randomFill();
    }
}

You would then need to use rand.nextDouble() in your randomFill() method the array to be filled is a double array. The below snippet should help you get random double values to be filled into your array.

double randomDoubleValue = rand.nextDouble();
return randomDoubleValue;