diff --git a/mypy.ini b/mypy.ini index 1a2282c44..123ffae85 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2,5 +2,5 @@ ignore_missing_imports = True install_types = True non_interactive = True -exclude = (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix_operation.py|other/fischer_yates_shuffle.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py) +exclude = (data_structures/stacks/next_greater_element.py|graphs/boruvka.py|graphs/breadth_first_search.py|graphs/breadth_first_search_2.py|graphs/check_cycle.py|graphs/finding_bridges.py|graphs/greedy_min_vertex_cover.py|graphs/random_graph_generator.py|maths/average_mode.py|maths/gamma_recursive.py|maths/proth_number.py|maths/series/geometric_series.py|maths/series/p_series.py|matrix_operation.py|other/least_recently_used.py|other/lfu_cache.py|other/lru_cache.py|searches/simulated_annealing.py|searches/ternary_search.py) diff --git a/other/fischer_yates_shuffle.py b/other/fischer_yates_shuffle.py index 035fcb482..fa2f4dce9 100644 --- a/other/fischer_yates_shuffle.py +++ b/other/fischer_yates_shuffle.py @@ -6,14 +6,15 @@ For more details visit wikipedia/Fischer-Yates-Shuffle. """ import random +from typing import Any -def fisher_yates_shuffle(data: list) -> list: - for _ in range(len(list)): - a = random.randint(0, len(list) - 1) - b = random.randint(0, len(list) - 1) - list[a], list[b] = list[b], list[a] - return list +def fisher_yates_shuffle(data: list) -> list[Any]: + for _ in range(len(data)): + a = random.randint(0, len(data) - 1) + b = random.randint(0, len(data) - 1) + data[a], data[b] = data[b], data[a] + return data if __name__ == "__main__":