From 0dc0969cd0a732760f0aa79942a04e0eaef297c4 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 16 Apr 2017 16:03:23 +0000 Subject: Vendor import of libc++ trunk r300422: https://llvm.org/svn/llvm-project/libcxx/trunk@300422 --- test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp | 5 ++++- .../algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'test/std/algorithms/alg.sorting/alg.nth.element') diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp index 560bc902b482..b43d88fe0cc6 100644 --- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp @@ -16,8 +16,11 @@ // nth_element(Iter first, Iter nth, Iter last); #include +#include #include +std::mt19937 randomness; + void test_one(int N, int M) { @@ -26,7 +29,7 @@ test_one(int N, int M) int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::nth_element(array, array+M, array+N); assert(array[M] == M); std::nth_element(array, array+N, array+N); // begin, end, end diff --git a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp index f2c962724f09..88249ed78d27 100644 --- a/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp +++ b/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -32,6 +33,8 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +std::mt19937 randomness; + void test_one(int N, int M) { @@ -40,7 +43,7 @@ test_one(int N, int M) int* array = new int[N]; for (int i = 0; i < N; ++i) array[i] = i; - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::nth_element(array, array+M, array+N, std::greater()); assert(array[M] == N-M-1); std::nth_element(array, array+N, array+N, std::greater()); // begin, end, end -- cgit v1.2.3