Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ def shuffle(self, x):
"""Shuffle list x in place, and return None."""

randbelow = self._randbelow
for i in reversed(range(1, len(x))):
# Iterate over the list x in reverse order
for i in range(len(x)-1,0,-1):
# 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]
Expand Down
Loading