diff --git a/3rdparty/utf8-cpp/CMakeLists.txt b/3rdparty/utf8-cpp/CMakeLists.txt index b7575fe4e..03be826d8 100644 --- a/3rdparty/utf8-cpp/CMakeLists.txt +++ b/3rdparty/utf8-cpp/CMakeLists.txt @@ -1,2 +1 @@ cmake_minimum_required(VERSION 3.0) -set(CMAKE_CXX_STANDARD 11) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83baa4a8d..b0673cd50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,12 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD") set(OPENBSD ON) endif() -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) list(APPEND COMPILE_OPTIONS $<$:--std=c99> - $<$:--std=c++11> + $<$:--std=c++17> -U__STRICT_ANSI__ -Wall -Wextra @@ -375,7 +375,7 @@ endif(USE_BUNDLE AND NOT USE_BUNDLE_DIR) # Check that we have sqlite3 with FTS5 if(NOT CMAKE_CROSSCOMPILING) - set(CMAKE_REQUIRED_FLAGS "--std=c++11") + set(CMAKE_REQUIRED_FLAGS "--std=c++17") set(CMAKE_REQUIRED_LIBRARIES ${QtCore_LIBRARIES} ${QtSql_LIBRARIES}) check_cxx_source_runs(" #include diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 203328828..63124acb2 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -1819,6 +1820,9 @@ void Playlist::ReshuffleIndices() { if (current_virtual_index_ != -1) std::advance(begin, current_virtual_index_ + 1); + std::random_device rd; + std::mt19937 g(rd()); + switch (playlist_sequence_->shuffle_mode()) { case PlaylistSequence::Shuffle_Off: // Handled above. @@ -1826,7 +1830,7 @@ void Playlist::ReshuffleIndices() { case PlaylistSequence::Shuffle_All: case PlaylistSequence::Shuffle_InsideAlbum: - std::random_shuffle(begin, end); + std::shuffle(begin, end, g); break; case PlaylistSequence::Shuffle_Albums: { @@ -1843,7 +1847,7 @@ void Playlist::ReshuffleIndices() { // Shuffle them QStringList shuffled_album_keys = album_key_set.values(); - std::random_shuffle(shuffled_album_keys.begin(), shuffled_album_keys.end()); + std::shuffle(shuffled_album_keys.begin(), shuffled_album_keys.end(), g); // If the user is currently playing a song, force its album to be first // Or if the song was not playing but it was selected, force its album to be first.