File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 2
2
ignore_missing_imports = True
3
3
install_types = True
4
4
non_interactive = True
5
- 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)
5
+ 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)
6
6
Original file line number Diff line number Diff line change 6
6
wikipedia/Fischer-Yates-Shuffle.
7
7
"""
8
8
import random
9
+ from typing import Any
9
10
10
11
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
17
18
18
19
19
20
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments