I generated 1-10 random numbers and stored it in an array. My question is how I'm going to code this first, random three times if 2 or all of them are duplicates then random again three times and if they are different from each other then save to the array. so here's my code:
CODE:
int min=1;
int max=10;
int y=0;
Random rand = new Random();
for(int count=0;count<1;count++){
int randomNum = rand.nextInt((max - min) + 1) + min;
arr[count] = randomNum;
}
System.out.println(arr[0]);//for checking
System.out.println(randomNum);//for checking