Commit 82ab01a7 authored by Ömer Fadıl Usta's avatar Ömer Fadıl Usta 😊
Browse files

update random_shuffle for equivalent of cpp17

parent 97bbfdc8
......@@ -83,12 +83,15 @@ void ChunkSelector::init(ChunkManager *cman, Downloader *downer, PeerManager *pm
bt::ChunkSelectorInterface::init(cman, downer, pman);
std::vector<Uint32> tmp;
std::random_device rd;
std::mt19937 g(rd());
for (Uint32 i = 0; i < cman->getNumChunks(); i++) {
if (!cman->getBitSet().get(i)) {
std::random_shuffle(tmp.begin(), tmp.end());
std::shuffle(tmp.begin(),tmp.end(), g);
// 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());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment