commit | 85c20a41dfcec04d161ad7da7260e7b94c62d228 | [log] [tgz] |
---|---|---|
author | Raymond Hettinger <python@rcn.com> | Thu Nov 06 14:06:48 2003 +0000 |
committer | Raymond Hettinger <python@rcn.com> | Thu Nov 06 14:06:48 2003 +0000 |
tree | 0d9e5b294ab4890b72ddc61d193036ac1d4b5ca4 | |
parent | f607fc5395883ff924c76739e9b0921953568e54 [diff] [blame] |
Implement and apply PEP 322, reverse iteration
diff --git a/Lib/random.py b/Lib/random.py index 16b667a..1f279bb 100644 --- a/Lib/random.py +++ b/Lib/random.py
@@ -253,7 +253,7 @@ if random is None: random = self.random - for i in xrange(len(x)-1, 0, -1): + for i in reversed(xrange(1, len(x))): # pick an element in x[:i+1] with which to exchange x[i] j = int(random() * (i+1)) x[i], x[j] = x[j], x[i]