diff options
Diffstat (limited to 'tools/bugpoint/ListReducer.h')
-rw-r--r-- | tools/bugpoint/ListReducer.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/bugpoint/ListReducer.h b/tools/bugpoint/ListReducer.h index dcfa11d06927f..0f9db022d555e 100644 --- a/tools/bugpoint/ListReducer.h +++ b/tools/bugpoint/ListReducer.h @@ -19,6 +19,7 @@ #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cstdlib> +#include <random> #include <vector> namespace llvm { @@ -46,7 +47,7 @@ template <typename ElTy> struct ListReducer { /// that bugpoint does. Expected<bool> reduceList(std::vector<ElTy> &TheList) { std::vector<ElTy> empty; - std::srand(0x6e5ea738); // Seed the random number generator + std::mt19937 randomness(0x6e5ea738); // Seed the random number generator Expected<TestResult> Result = doTest(TheList, empty); if (Error E = Result.takeError()) return std::move(E); @@ -92,7 +93,7 @@ template <typename ElTy> struct ListReducer { // distribution (improving the speed of convergence). if (ShufflingEnabled && NumOfIterationsWithoutProgress > MaxIterations) { std::vector<ElTy> ShuffledList(TheList); - std::random_shuffle(ShuffledList.begin(), ShuffledList.end()); + std::shuffle(ShuffledList.begin(), ShuffledList.end(), randomness); errs() << "\n\n*** Testing shuffled set...\n\n"; // Check that random shuffle doesn't lose the bug Expected<TestResult> Result = doTest(ShuffledList, empty); |