The goal of this program is to have A2[] display the numbers 1-10 in a random order.It needs to be done without anything past base level knowledge. A2[] gets the numbers from A1[], the A1[] array has the numbers 1-10 stored in sequence. In its current state the program runs, but does not filter out results that have already been store in A2[]. For example.... 4,2,3,7,5,9,7,1,4 should not be able to be a result. Only a random order of 1-10 should display, with each int occurring only once. Any help is greatly appreciated. The code presently is as follows : `
public class W07problem07 {
public static int getRandomIntRange(int min, int max) {
int x = (int) (Math.random() * ((max - min))) + min;
return x;
}
public static void main(String[] args) {
int ranNum;
int count = 1;
int[] A1 = new int[10];
int[] A2 = new int[10];
//loop for storing 1-10 int number withing A1[].
for (int k = 0; k < A1.length; k++) {
A1[k] = count;
count++;
}
for (int k = 0; k < A2.length; k++) {
A2[k] = k;
}
for (int j = 0; j < A2.length; j++) {
int a;
ranNum = getRandomIntRange(0, A2.length);
a = A2[j];
if(a==ranNum){
j--;
} else{
A2[j]= A1[ranNum];
}
}
for (int k = 0; k < A2.length; k++) {
System.out.println(A2[k]);
}
}
}
`