Skip to content

Fix shuffle mode replaying tracks and Previous ignoring shuffle order#1

Open
eeksock wants to merge 1 commit into
serkantanriverdi:mainfrom
eeksock:fix-shuffle-repeats
Open

Fix shuffle mode replaying tracks and Previous ignoring shuffle order#1
eeksock wants to merge 1 commit into
serkantanriverdi:mainfrom
eeksock:fix-shuffle-repeats

Conversation

@eeksock

@eeksock eeksock commented Jul 19, 2026

Copy link
Copy Markdown

nextTrack picked a uniformly random index on every call, which is sampling with replacement rather than a shuffle. This means that tracks could repeat often (even back-to-back) well before the full list had played once.

Further, prevTrack also always stepped back by list index regardless of mode, so Previous after a shuffled Next could land somewhere unrelated.

Replace this with a proper Fisher-Yates permutation of track indices that is consumed in order by Next and walked backward by Previous, so every track plays once per cycle with no immediate repeats across cycle boundaries. Manual track picks (e.g. double-click) resync the shuffle position so Next/Prev stay consistent afterward.

nextTrack picked a uniformly random index on every call, which is
sampling with replacement rather than a shuffle - tracks could repeat
often (even back-to-back) well before the full list had played once.
prevTrack also always stepped back by list index regardless of mode,
so Previous after a shuffled Next could land somewhere unrelated.

Replace this with a proper Fisher-Yates permutation of track indices
that is consumed in order by Next and walked backward by Previous, so
every track plays once per cycle with no immediate repeats across
cycle boundaries. Manual track picks (e.g. double-click) resync the
shuffle position so Next/Prev stay consistent afterward.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant