Fix AllOrNothing and random.sample()

o AllOrNothing no longer fails occasionally. Patch by Lorenz Quack
o random.sample() works on Python 2.1. Patch by Paul Koning and Lorenz
  Quack
This commit is contained in:
Thorsten Behrens 2011-01-06 07:18:12 -05:00
parent b27696462b
commit 60896cc61a
3 changed files with 7 additions and 9 deletions

View file

@ -122,7 +122,7 @@ class StrongRandom(object):
selected = {} # we emulate a set using a dict here
for i in xrange(k):
r = None
while r is None or r in selected:
while r is None or selected.has_key(r):
r = self.randrange(num_choices)
retval.append(population[r])
selected[r] = 1