This one is very simple and basic, but for some reason I cant get it right. So I'm making a for loop and inside the for loop generating random numbers, but I want to eliminate some numbers by redoing the for loop when those numbers come up. how should I do it and whats my mistake. Thank you in advance.
How I did it:
int[] array= new int[6];
for(int i=0;i<array.length;i++){
Random rand = new Random();
int n = rand.nextInt(50) + 1;
if(n==5 || n==9 || n==13){
i--;
return;
}
array[i]=n;
}