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:
Edwin Jarvis 2026-05-11 15:23:37 +08:00 committed by Elad
parent c534da86c3
commit 6fa7efbcc3

View File

@ -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);
}
}