Skip to content

Commit 2cc5cf4

Browse files
committed
fischer_yates_shuffle: fixes bug introduced by partial renaming in TheAlgorithms#4673
1 parent 5c8a6c8 commit 2cc5cf4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: other/fischer_yates_shuffle.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010

1111
def fisher_yates_shuffle(data: list) -> list:
12-
for _ in range(len(list)):
13-
a = random.randint(0, len(list) - 1)
14-
b = random.randint(0, len(list) - 1)
15-
list[a], list[b] = list[b], list[a]
16-
return list
12+
for _ in range(len(data)):
13+
a = random.randint(0, len(data) - 1)
14+
b = random.randint(0, len(data) - 1)
15+
data[a], data[b] = data[b], data[a]
16+
return data
1717

1818

1919
if __name__ == "__main__":

0 commit comments

Comments
 (0)