aboutsummaryrefslogtreecommitdiff
path: root/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/algorithms/alg.sorting/alg.heap.operations/make.heap')
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp5
-rw-r--r--test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp8
2 files changed, 9 insertions, 4 deletions
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp
index 9da9356b0be1..082cad5f2d08 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp
@@ -15,14 +15,17 @@
// make_heap(Iter first, Iter last);
#include <algorithm>
+#include <random>
#include <cassert>
+std::mt19937 randomness;
+
void test(int N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
ia[i] = i;
- std::random_shuffle(ia, ia+N);
+ std::shuffle(ia, ia+N, randomness);
std::make_heap(ia, ia+N);
assert(std::is_heap(ia, ia+N));
delete [] ia;
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
index 9d0545f0d9c5..01183d16c927 100644
--- a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
+++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
@@ -17,6 +17,7 @@
#include <algorithm>
#include <functional>
#include <memory>
+#include <random>
#include <cassert>
#include "test_macros.h"
@@ -29,6 +30,7 @@ struct indirect_less
{return *x < *y;}
};
+std::mt19937 randomness;
void test(int N)
{
@@ -36,7 +38,7 @@ void test(int N)
{
for (int i = 0; i < N; ++i)
ia[i] = i;
- std::random_shuffle(ia, ia+N);
+ std::shuffle(ia, ia+N, randomness);
std::make_heap(ia, ia+N, std::greater<int>());
assert(std::is_heap(ia, ia+N, std::greater<int>()));
}
@@ -64,7 +66,7 @@ void test(int N)
// Random
{
binary_counting_predicate<std::greater<int>, int, int> pred ((std::greater<int>()));
- std::random_shuffle(ia, ia+N);
+ std::shuffle(ia, ia+N, randomness);
std::make_heap(ia, ia+N, std::ref(pred));
assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
@@ -90,7 +92,7 @@ int main()
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
for (int i = 0; i < N; ++i)
ia[i].reset(new int(i));
- std::random_shuffle(ia, ia+N);
+ std::shuffle(ia, ia+N, randomness);
std::make_heap(ia, ia+N, indirect_less());
assert(std::is_heap(ia, ia+N, indirect_less()));
delete [] ia;