We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a0f5c8e commit 0b26422Copy full SHA for 0b26422
Lib/random.py
@@ -355,7 +355,8 @@ def shuffle(self, x):
355
"""Shuffle list x in place, and return None."""
356
357
randbelow = self._randbelow
358
- for i in reversed(range(1, len(x))):
+ # Iterate over the list x in reverse order
359
+ for i in range(len(x)-1,0,-1):
360
# pick an element in x[:i+1] with which to exchange x[i]
361
j = randbelow(i + 1)
362
x[i], x[j] = x[j], x[i]
0 commit comments