Mercurial > hg > CbC > CbC_llvm
diff unittests/ADT/TinyPtrVectorTest.cpp @ 121:803732b1fca8
LLVM 5.0
author | kono |
---|---|
date | Fri, 27 Oct 2017 17:07:41 +0900 |
parents | 1172e4bd9c6f |
children | 3a76565eade5 |
line wrap: on
line diff
--- a/unittests/ADT/TinyPtrVectorTest.cpp Fri Nov 25 19:14:25 2016 +0900 +++ b/unittests/ADT/TinyPtrVectorTest.cpp Fri Oct 27 17:07:41 2017 +0900 @@ -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 @@ 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) {