diff options
| author | Thorsten Behrens <sbehrens@gmx.li> | 2010-12-31 00:15:34 -0500 |
|---|---|---|
| committer | Thorsten Behrens <sbehrens@gmx.li> | 2010-12-31 00:15:34 -0500 |
| commit | 5dc2f8f216a49ff2254dc1edc451904e188e5e9b (patch) | |
| tree | c513f07e570ea7bde3acb4a2c00c35b3e2cd510d /lib/Crypto/Random | |
| parent | 4082de9a483d63f49746b1a96d988b5423aa44b6 (diff) | |
| download | pycrypto-5dc2f8f216a49ff2254dc1edc451904e188e5e9b.tar.gz | |
Add unit tests for Crypto.Random.random
o Add unit tests
o Fix random.shuffle()
o random.sample() does not work on 2.1. This has not been fixed.
Diffstat (limited to 'lib/Crypto/Random')
| -rw-r--r-- | lib/Crypto/Random/random.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Crypto/Random/random.py b/lib/Crypto/Random/random.py index 28a99ea..bc08889 100644 --- a/lib/Crypto/Random/random.py +++ b/lib/Crypto/Random/random.py @@ -109,9 +109,9 @@ class StrongRandom(object): # Choose a random item (without replacement) until all the items have been # chosen. for i in xrange(len(x)): - p = self.randint(len(items)) - x[i] = items[p] - del items[p] + p = self.randint(1,len(items)) + x[i] = items[p-1] + del items[p-1] def sample(self, population, k): """Return a k-length list of unique elements chosen from the population sequence.""" |
