i want to try to put a unique random number from shuffled list to array but keep failing.
im using this answer with little modification.
this is my method
ArrayList<Integer> list = new ArrayList<>();
    for(int i=0;i<10;i++) {
        list.add(i);}
    Collections.shuffle(list);
    for(int x=0;x<3;x++){
        RNGee=RNG.nextInt(9);
        RN[x]=list.get(RNGee);
        if(RN[x]==QNum){
            x=0;
        }
    }
When i print out the RN array, some of it have a chance to get same value.
Is there something wrong with my code ? Please explain it to me. Thank you.
 
     
     
    