From f82ff345b2d36c595ef3536b5cffd317b3fd8723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 14 Apr 2024 12:25:26 +0200 Subject: Fix compatibility with C++17. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit 072f90b8c13c11751797064503be13436fbd5f9a) --- libktorrent/torrent/chunkselector.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libktorrent/torrent/chunkselector.cpp b/libktorrent/torrent/chunkselector.cpp index b1c42fa..d5d6cc6 100644 --- a/libktorrent/torrent/chunkselector.cpp +++ b/libktorrent/torrent/chunkselector.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include "chunkcounter.h" @@ -79,7 +80,9 @@ namespace bt tmp.push_back(i); } } - std::random_shuffle(tmp.begin(),tmp.end()); + std::random_device randomDev; + std::mt19937 randomGenerator(randomDev()); + std::shuffle(tmp.begin(), tmp.end(), randomGenerator); // std::list does not support random_shuffle so we use a vector as a temporary storage // for the random_shuffle chunks.insert(chunks.begin(),tmp.begin(),tmp.end()); -- cgit v1.2.1