I created this method randomInt, that gives a random number, between -5, and 15. I created another method randomIntArray that calls randomInt, in a loop, and stores the random integers into an array. However, when I try to print it, it just returns an ArrayIndexOutOfBoundsException.  
public static int randomInt(int low, int high) {
    double e;
    double x = Math.random();
    e = low + x * (high - low);
    return (int) e;
}
public static int[] randomIntArray(int n) {
    int[] a = new int[n];
    for (int i = 0; i < a.length; i++) {
        a[i] = randomInt(-5, 15); //"-5&15 are the lower and upper bounds of the random number array
    }
    return a;
}
In randomInt, When I didn't cast the return value into an int, it worked, however I need it to return an int for the array to work.
 
     
    
 
    