aboutsummaryrefslogtreecommitdiff
path: root/unittests/ADT/TinyPtrVectorTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/ADT/TinyPtrVectorTest.cpp')
-rw-r--r--unittests/ADT/TinyPtrVectorTest.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/unittests/ADT/TinyPtrVectorTest.cpp b/unittests/ADT/TinyPtrVectorTest.cpp
index 26189b76394f..8d5fa4060913 100644
--- a/unittests/ADT/TinyPtrVectorTest.cpp
+++ b/unittests/ADT/TinyPtrVectorTest.cpp
@@ -17,19 +17,13 @@
#include "llvm/Support/type_traits.h"
#include "gtest/gtest.h"
#include <algorithm>
+#include <random>
#include <vector>
using namespace llvm;
namespace {
-// The world's worst RNG, but it is deterministic and makes it easy to get
-// *some* shuffling of elements.
-static ptrdiff_t test_shuffle_rng(ptrdiff_t i) {
- return (i + i * 33) % i;
-}
-static ptrdiff_t (*test_shuffle_rng_p)(ptrdiff_t) = &test_shuffle_rng;
-
template <typename VectorT>
class TinyPtrVectorTest : public testing::Test {
protected:
@@ -46,7 +40,7 @@ protected:
for (size_t i = 0, e = array_lengthof(TestValues); i != e; ++i)
TestPtrs.push_back(&TestValues[i]);
- std::random_shuffle(TestPtrs.begin(), TestPtrs.end(), test_shuffle_rng_p);
+ std::shuffle(TestPtrs.begin(), TestPtrs.end(), std::mt19937{});
}
ArrayRef<PtrT> testArray(size_t N) {