So, I did re did the e=(high-low)*x+low, however, when I try to use it, it just returns an outOfBounds exception. When I didn't cast it into an int, it worked, however I ned it to return an integer, for the array to work.
public static int randomInt(int low, int high)
    {double e;
    double x=Math.random();
        e=(high-low)*x+low;
    return (int)e;}
Here is the method that calls the "randomInt" method
public static int[] randomIntArray(int n)//generates an array of random numbers based on an upper and lower bound
    {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;}
 
     
     
     
    