shuffle static method
Randomize the positions of items in a list.
Implementation
static List shuffle(List list) {
for (int i = 0, l = list.length; i < l; i++) {
int j = random.nextInt(l);
if (j == i) {
continue;
}
dynamic item = list[j];
list[j] = list[i];
list[i] = item;
}
return list;
}