Fix C++14 deprecated random_shuffle.
This commit is contained in:
parent
0145d9d514
commit
48bcf66ac7
|
|
@ -43,6 +43,17 @@ extern std::string VL_TO_STRING(QData lhs);
|
||||||
inline std::string VL_TO_STRING(const std::string& obj) { return "\"" + obj + "\""; }
|
inline std::string VL_TO_STRING(const std::string& obj) { return "\"" + obj + "\""; }
|
||||||
extern std::string VL_TO_STRING_W(int words, WDataInP obj);
|
extern std::string VL_TO_STRING_W(int words, WDataInP obj);
|
||||||
|
|
||||||
|
//===================================================================
|
||||||
|
// Shuffle RNG
|
||||||
|
|
||||||
|
class VlURNG {
|
||||||
|
public:
|
||||||
|
typedef size_t result_type;
|
||||||
|
static size_t min() { return 0; }
|
||||||
|
static size_t max() { return 1ULL << 31; }
|
||||||
|
size_t operator()() { return VL_MASK_I(31) & VL_RANDOM_I(32); }
|
||||||
|
};
|
||||||
|
|
||||||
//===================================================================
|
//===================================================================
|
||||||
// Readmem/Writemem operation classes
|
// Readmem/Writemem operation classes
|
||||||
|
|
||||||
|
|
@ -246,10 +257,7 @@ public:
|
||||||
[=](const T_Value& a, const T_Value& b) { return with_func(a) < with_func(b); });
|
[=](const T_Value& a, const T_Value& b) { return with_func(a) < with_func(b); });
|
||||||
}
|
}
|
||||||
void reverse() { std::reverse(m_deque.begin(), m_deque.end()); }
|
void reverse() { std::reverse(m_deque.begin(), m_deque.end()); }
|
||||||
void shuffle() {
|
void shuffle() { std::shuffle(m_deque.begin(), m_deque.end(), VlURNG()); }
|
||||||
std::shuffle(m_deque.begin(), m_deque.end(),
|
|
||||||
[=](int) { return VL_RANDOM_I(32) % m_deque.size(); });
|
|
||||||
}
|
|
||||||
VlQueue unique() const {
|
VlQueue unique() const {
|
||||||
VlQueue out;
|
VlQueue out;
|
||||||
std::set<T_Value> saw;
|
std::set<T_Value> saw;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue