From 85c20a41dfcec04d161ad7da7260e7b94c62d228 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 6 Nov 2003 14:06:48 +0000 Subject: Implement and apply PEP 322, reverse iteration --- Lib/random.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/random.py') diff --git a/Lib/random.py b/Lib/random.py index 16b667a3af2..1f279bb8782 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] -- cgit v1.2.3