Repository navigation
Fix deterministic playlist shuffling by migrating to modern C++ std::shuffle (Fixes #756) - #879
Open
dhruvajshetty wants to merge 1 commit into
Open
dhruvajshetty wants to merge 1 commit into
dhruvajshetty wants to merge 1 commit into
Conversation
Member
|
Thanks for picking this up, @dhruvajshetty, and for opening PR #879. We’re doing a broad v1 revival in parallel, so this area may change and the patch might need adapting; I don’t want to promise it can be merged unchanged. But contributions are very welcome, and it’s great to have something concrete to review. We’ll coordinate the review with the ongoing work—thanks for getting involved. |
Author
|
Thank you, let me know if any change is required from my side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes issue #756 where local playback playlists were consistently shuffled in the identical order upon initialization.
What was changed
The root cause was the usage of the deprecated
std::random_shuffle. Depending on the platform implementation, it often relies on an underlying generator that wasn't being correctly influenced by thestd::srand(time(nullptr))seed on startup.I updated the shuffle logic in
tizplaylist.cppto use the modern C++11<random>library:#include <random>std::random_shufflewithstd::shufflestd::random_deviceand astd::mt19937Mersenne Twister engine to guarantee true randomized seeding on every execution.Related Issue
Fixes #756