My assignment:
A simple random generator is obtained by the formula
= ( ⋅ + )%. New “random” numbers are then generated by settingtoand repeating the process. Write a method that asks the user to enter a value for , , and . Your method should return an array of integers that contain the first 25 “random” values generated by this formula.
So far this is what I have, but for some reason my code is not printing the array of random 25 numbers
public static void main(String[] args){
        Scanner theInput = new Scanner(System.in);
        System.out.println("Enter a value for r: ");
        int r = theInput.nextInt();
        System.out.println("Enter a value for a: ");
        int a = theInput.nextInt();
        System.out.println("Enter a value for b: ");
        int b = theInput.nextInt();
        System.out.println("Enter a value for m: ");
        int m = theInput.nextInt();
        System.out.println(random(r,a,b,m));
    }
    public static int[] random(int r, int a, int b, int m){
        String num = "";
        int numberArray[] = new int [25];
        for (int i = 0; i < numberArray.length; i++) {
            int answer = (a*r+b)%m;
            numberArray [i] = answer;
        }
        for(int i=0;i<numberArray.length;i++){
            System.out.println(numberArray[i]);
        }
        System.out.println();
        return numberArray; 
    }
This is what is printing:
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
258
[I@55f96302
Can someone help me to fix the problem?
 
     
     
     
    