other.fischer_yates_shuffle

The Fisher-Yates shuffle is an algorithm for generating a random permutation of a finite sequence. For more details visit wikipedia/Fischer-Yates-Shuffle.

Attributes

integers

Functions

fisher_yates_shuffle(→ list[Any])

Module Contents

other.fischer_yates_shuffle.fisher_yates_shuffle(data: list) list[Any]
>>> import random
>>> from unittest.mock import patch
>>> with patch('random.randint', side_effect=[0, 3, 1, 2, 2, 0, 3, 1]):
...     fisher_yates_shuffle(["python", "says", "hello", "!"])
['says', 'python', '!', 'hello']
other.fischer_yates_shuffle.integers = [0, 1, 2, 3, 4, 5, 6, 7]