mercredi 28 septembre 2016

Shuffle not working on random array

Could someone tell me why this keeps returning repeated values

void d(){
ArrayList<Integer> list = new ArrayList<Integer>();
for (int i=1; i<12; i++) {
    list.add(new Integer(r.nextInt(50-1)+1));
    Collections.shuffle(list);
}

for (int i=0; i<11; i++) {
    random[i]=list.get(i);
    System.out.println(list.get(i));
}

}




Aucun commentaire:

Enregistrer un commentaire