summaryrefslogtreecommitdiffstats
path: root/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp')
-rw-r--r--test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp5
1 files changed, 4 insertions, 1 deletions
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 f2c962724..88249ed78 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 <algorithm>
#include <functional>
#include <vector>
+#include <random>
#include <cassert>
#include <cstddef>
#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<int>());
assert(array[M] == N-M-1);
std::nth_element(array, array+N, array+N, std::greater<int>()); // begin, end, end