Ian Kelly <[email protected]> writes: > j = int(random() * n) > while j in selected: > j = int(random() * n)
from itertools import dropwhile
j = dropwhile(lambda j: j in selected,
iter(lambda: int(random() * n), object()))
.next()
kind of ugly, makes me wish for a few more itertools primitives, but I
think it expresses reasonably directly what you are trying to do.
--
http://mail.python.org/mailman/listinfo/python-list
