diff --git a/Lib/random.py b/Lib/random.py index 3a835aef0bc1d4..cd818a4e102e37 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -389,7 +389,7 @@ def shuffle(self, x, random=None): if random is None: randbelow = self._randbelow - for i in reversed(range(1, len(x))): + for i in range(1, len(x)): # pick an element in x[:i+1] with which to exchange x[i] j = randbelow(i + 1) x[i], x[j] = x[j], x[i] @@ -399,7 +399,7 @@ def shuffle(self, x, random=None): 'version.', DeprecationWarning, 2) floor = _floor - for i in reversed(range(1, len(x))): + for i in range(1, len(x)): # pick an element in x[:i+1] with which to exchange x[i] j = floor(random() * (i + 1)) x[i], x[j] = x[j], x[i]