NiCE CXone needs to generate randomized song queues for a playlist simulation. Given a list of unique song identifiers, produce a separate random ordering for each iteration. Every iteration must contain every song exactly once, and the input order must remain unchanged.
Use a deterministic pseudo-random sequence controlled by seed so the result can be reproduced during testing. Implement the shuffle with the Fisher-Yates algorithm. You may use a linear congruential generator for pseudo-random indices:
state = (state * 1664525 + 1013904223) mod 2^32
For each position i from the end of the list down to 1, use state mod (i + 1) as the swap index.
Implement generate_song_iterations(songs, iterations, seed), where songs is a list of unique strings, iterations is a nonnegative integer, and seed is a nonnegative integer. Return a list containing iterations shuffled copies of songs.
def generate_song_iterations(songs, iterations, seed):