Skip to content

Commit e78d509

Browse files
[mypy] Fix other/fischer_yates_shuffle.py
1 parent 8ac86f2 commit e78d509

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

other/fischer_yates_shuffle.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
wikipedia/Fischer-Yates-Shuffle.
77
"""
88
import random
9+
from typing import Any
910

1011

11-
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+
def fisher_yates_shuffle(data: list) -> list[Any]:
13+
for _ in range(len(data)):
14+
a = random.randint(0, len(data) - 1)
15+
b = random.randint(0, len(data) - 1)
16+
data[a], data[b] = data[b], data[a]
17+
return data
1718

1819

1920
if __name__ == "__main__":

0 commit comments

Comments
 (0)