static IterableIterator shuffledIterator(fL l) {
ret new IterableIterator() {
int n = l(l);
int i = 0;
new Map shuffled;
public bool hasNext() { ret i < n; }
public A next() {
int j = random(i, n);
A a = get(i), b = get(j);
shuffled.put(j, a);
shuffled.remove(i);
++i;
ret b;
}
A get(int i) {
ret shuffled.containsKey(i) ? shuffled.get(i) : l.get(i);
}
};
}