Skip to main content

✅ Shuffle deterministic

CategoryAbility
StatusPassing
Testtests/test_rng.py::test_shuffle_deterministic

Two RNGs with the same seed shuffle an identical list in the

Preconditions

  • rng_a = DeterministicRNG(seed=123)

  • rng_b = DeterministicRNG(seed=123)

  • lst_a = lst_b = [1..10]

Action

  • rng_a.shuffle(lst_a), rng_b.shuffle(lst_b)

Expected Postconditions

  • lst_a == lst_b (same permutation).

  • Neither list equals [1..10] (it was shuffled).

Assertions

assert lst_a == lst_b
assert lst_a != list(range(1, 11))