summaryrefslogtreecommitdiff
path: root/lib/Crypto/Random
diff options
context:
space:
mode:
authorThorsten Behrens <sbehrens@gmx.li>2011-01-06 07:18:12 -0500
committerThorsten Behrens <sbehrens@gmx.li>2011-01-06 07:18:12 -0500
commit60896cc61a960e6bfef680ad890c0f848c9fc27c (patch)
treed8ce1bbb517917f20e1fa1603a44a8f2384827e9 /lib/Crypto/Random
parentb27696462b1e7c6c53ce2ac6760567eb6ff744b6 (diff)
downloadpycrypto-60896cc61a960e6bfef680ad890c0f848c9fc27c.tar.gz
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
Diffstat (limited to 'lib/Crypto/Random')
-rw-r--r--lib/Crypto/Random/random.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Crypto/Random/random.py b/lib/Crypto/Random/random.py
index 9d969f2..bef02e6 100644
--- a/lib/Crypto/Random/random.py
+++ b/lib/Crypto/Random/random.py
@@ -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