summaryrefslogtreecommitdiffstats
path: root/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2017-03-14 15:12:59 -0700
committerDan Albert <danalbert@google.com>2017-03-14 15:12:59 -0700
commitb9e7f084bdb262592ef617346fec3efeeadc12d9 (patch)
tree98be0728c8a7e96003719c4145662f487a663d81 /test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
parentcebe3685c0b367477d3f708c3fb0a278ab645c06 (diff)
parent0b23f9c81d7d86cd023d5b43292e22bff76443e6 (diff)
downloadexternal_libcxx-b9e7f084bdb262592ef617346fec3efeeadc12d9.tar.gz
external_libcxx-b9e7f084bdb262592ef617346fec3efeeadc12d9.tar.bz2
external_libcxx-b9e7f084bdb262592ef617346fec3efeeadc12d9.zip
Merge to upstream r297772.
Bug: None Test: make checkbuild && ./run_tests.py Change-Id: I9e755c76a760f218abd871008e3d48c8f044afd1
Diffstat (limited to 'test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp')
-rw-r--r--test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
index c2805a656..acede6ff7 100644
--- a/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp
@@ -15,10 +15,13 @@
// minmax_element(Iter first, Iter last);
#include <algorithm>
+#include <random>
#include <cassert>
#include "test_iterators.h"
+std::mt19937 randomness;
+
template <class Iter>
void
test(Iter first, Iter last)
@@ -46,7 +49,7 @@ test(int N)
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = i;
- std::random_shuffle(a, a+N);
+ std::shuffle(a, a+N, randomness);
test(Iter(a), Iter(a+N));
delete [] a;
}
@@ -66,7 +69,7 @@ test()
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 5;
- std::random_shuffle(a, a+N);
+ std::shuffle(a, a+N, randomness);
std::pair<Iter, Iter> p = std::minmax_element(Iter(a), Iter(a+N));
assert(base(p.first) == a);
assert(base(p.second) == a+N-1);