PM123 shuffle mode
From PM123 1.41 a new shuffle algorithm has been implemented. It
provides the following properties:
- Shuffle is deterministic. I.e. using
previous/next song
results in repeatable behavior. This includes nested playlists.
- The deterministic shuffle sequence changes only if the top level
playlist has been completed or if a new (or the same) object is loaded
into the player.
- Items in different, nested playlists are never exchanged.
I.e. all items of one nested playlists are played before another
(random) item of the parent playlist is taken.
- It keeps the order of unmodified items when the
playlist is altered. Even reloading a playlist from disk does not
change the shuffle sequence for items that still exist somewhere in the
list.
- It inserts new playlist items at a random location. This implies
that new items might not be played if the playback is already active.
- Moving playlist item inside a list does not change the shuffle
sequence.
- Changing properties of playlist items does not change the shuffle
sequence.
- The shuffle mode can be enabled or disabled in playlist references. This
overrides the user setting for a nested playlist.
How does it work?
- PM123 gives each playlist item a unique id.
- A random seed is created when shuffle is enabled.
- A hash value is calculated for each playlist item from the random
seed an the unique id.
- The items in each playlist are ordered by this hash.
That's all.