mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-05-12 16:19:44 -06:00
cellMusic: Fix shuffle always producing the same order
The shuffle in step_track() used std::default_random_engine with a default (fixed) seed, causing the playlist to be 'shuffled' into the same deterministic order every time. Use std::random_device to seed the engine so each shuffle produces a genuinely random order. Fixes #18672
This commit is contained in:
parent
6b5a2f781a
commit
544ba3bf20
@ -362,7 +362,8 @@ u32 music_selection_context::step_track(bool next)
|
||||
{
|
||||
// We reached the first or last track again. Let's shuffle!
|
||||
cellMusicSelectionContext.notice("step_track: Shuffling playlist...");
|
||||
auto engine = std::default_random_engine{};
|
||||
std::random_device rd;
|
||||
auto engine = std::default_random_engine{rd()};
|
||||
std::shuffle(std::begin(playlist), std::end(playlist), engine);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user