Fix compatibility with C++17.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/22/head
Slávek Banko 7 months ago
parent 1e588c37d4
commit 072f90b8c1
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -20,6 +20,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <random>
#include <util/log.h> #include <util/log.h>
#include <util/bitset.h> #include <util/bitset.h>
#include "chunkcounter.h" #include "chunkcounter.h"
@ -79,7 +80,9 @@ namespace bt
tmp.push_back(i); 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 // std::list does not support random_shuffle so we use a vector as a temporary storage
// for the random_shuffle // for the random_shuffle
chunks.insert(chunks.begin(),tmp.begin(),tmp.end()); chunks.insert(chunks.begin(),tmp.begin(),tmp.end());

Loading…
Cancel
Save