summaryrefslogtreecommitdiffstats
path: root/Lib/random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-11-06 14:06:48 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-11-06 14:06:48 (GMT)
commit85c20a41dfcec04d161ad7da7260e7b94c62d228 (patch)
tree0d9e5b294ab4890b72ddc61d193036ac1d4b5ca4 /Lib/random.py
parentf607fc5395883ff924c76739e9b0921953568e54 (diff)
downloadcpython-85c20a41dfcec04d161ad7da7260e7b94c62d228.zip
cpython-85c20a41dfcec04d161ad7da7260e7b94c62d228.tar.gz
cpython-85c20a41dfcec04d161ad7da7260e7b94c62d228.tar.bz2
Implement and apply PEP 322, reverse iteration
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py2
1 files changed, 1 insertions, 1 deletions
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 @@ class Random(_random.Random):
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]