summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2024-04-14 12:25:26 +0200
committerSlávek Banko <slavek.banko@axis.cz>2024-04-14 12:25:26 +0200
commit072f90b8c13c11751797064503be13436fbd5f9a (patch)
treecbb4e0eba0e0e12ccb14516a53a147c34bbaa466
parent1e588c37d4758677e6bc7f415bcb52e3880e68b3 (diff)
downloadktorrent-072f90b8c13c11751797064503be13436fbd5f9a.tar.gz
ktorrent-072f90b8c13c11751797064503be13436fbd5f9a.zip
Fix compatibility with C++17.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--libktorrent/torrent/chunkselector.cpp5
1 files changed, 4 insertions, 1 deletions
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 <stdlib.h>
#include <vector>
#include <algorithm>
+#include <random>
#include <util/log.h>
#include <util/bitset.h>
#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());