Alex Martelli schrieb: >> s = set(range(49)).powerset(6) >> for x in range(10): >> print s.pop() > > This is very systematic, not random;-). Still, using random.sample on s > would indeed produce 12 random different tips!-)
Right, that would be systematic. What I wanted to write was: s = set(range(49)).powerset(6) for x in range(10): c = choice(s) print c s.remove(c) Of course you could also use random.sample again: random.sample(set(range(49)).powerset(6), 10) But this would be just as inefficient. > tips = set() > while len(tips) < 10: > tip = frozenzet(random.sample(range(49), 6)) > tips.add(tip) Yep, that's better. The amount of hand coding is even the same as above. -- Christoph -- http://mail.python.org/mailman/listinfo/python-list