Author: marshall Date: Tue Feb 7 12:41:25 2017 New Revision: 294328 URL: http://llvm.org/viewvc/llvm-project?rev=294328&view=rev Log: Stop using random_shuffle in the libc++ test suite. It's going to be removed in c++17. Use shuffle() instead. No change to libc++, just the tests.
Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp Tue Feb 7 12:41:25 2017 @@ -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; Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -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; Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap.pass.cpp Tue Feb 7 12:41:25 2017 @@ -15,14 +15,17 @@ // pop_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); for (int i = N; i > 0; --i) { Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/pop_heap_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,10 +16,12 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> + struct indirect_less { template <class P> @@ -29,12 +31,14 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +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, std::greater<int>()); for (int i = N; i > 0; --i) { @@ -55,7 +59,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()); for (int i = N; i > 0; --i) { Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,14 +16,17 @@ // push_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); for (int i = 0; i <= N; ++i) { std::push_heap(ia, ia+i); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/push_heap_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -17,6 +17,7 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> @@ -30,12 +31,14 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +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); for (int i = 0; i <= N; ++i) { std::push_heap(ia, ia+i, std::greater<int>()); @@ -54,7 +57,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); for (int i = 0; i <= N; ++i) { std::push_heap(ia, ia+i, indirect_less()); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap.pass.cpp Tue Feb 7 12:41:25 2017 @@ -15,14 +15,17 @@ // sort_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); std::sort_heap(ia, ia+N); assert(std::is_sorted(ia, ia+N)); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,6 +16,7 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #include <memory> @@ -29,12 +30,14 @@ struct indirect_less #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +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, std::greater<int>()); std::sort_heap(ia, ia+N, std::greater<int>()); assert(std::is_sorted(ia, ia+N, std::greater<int>())); @@ -56,7 +59,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()); std::sort_heap(ia, ia+N, indirect_less()); assert(std::is_sorted(ia, ia+N, indirect_less())); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,6 +16,7 @@ // inplace_merge(Iter first, Iter middle, Iter last); #include <algorithm> +#include <random> #include <cassert> #include "test_iterators.h" @@ -42,6 +43,8 @@ struct S { }; #endif +std::mt19937 randomness; + template <class Iter> void test_one(unsigned N, unsigned M) @@ -51,7 +54,7 @@ test_one(unsigned N, unsigned M) value_type* ia = new value_type[N]; for (unsigned i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::sort(ia, ia+M); std::sort(ia+M, ia+N); std::inplace_merge(Iter(ia), Iter(ia+M), Iter(ia+N)); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -17,6 +17,7 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #include "test_macros.h" @@ -58,6 +59,8 @@ struct S { #include "test_iterators.h" #include "counting_predicates.hpp" +std::mt19937 randomness; + template <class Iter> void test_one(unsigned N, unsigned M) @@ -67,7 +70,7 @@ test_one(unsigned N, unsigned M) value_type* ia = new value_type[N]; for (unsigned i = 0; i < N; ++i) ia[i] = i; - std::random_shuffle(ia, ia+N); + std::shuffle(ia, ia+N, randomness); std::sort(ia, ia+M, std::greater<value_type>()); std::sort(ia+M, ia+N, std::greater<value_type>()); binary_counting_predicate<std::greater<value_type>, value_type, value_type> pred((std::greater<value_type>())); @@ -130,7 +133,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::sort(ia, ia+M, indirect_less()); std::sort(ia+M, ia+N, indirect_less()); std::inplace_merge(ia, ia+M, ia+N, indirect_less()); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp Tue Feb 7 12:41:25 2017 @@ -19,10 +19,13 @@ // merge(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2, OutIter result); #include <algorithm> +#include <random> #include <cassert> #include "test_iterators.h" +std::mt19937 randomness; + template <class InIter1, class InIter2, class OutIter> void test() @@ -53,7 +56,7 @@ test() int* ic = new int[2*N]; for (unsigned i = 0; i < 2*N; ++i) ic[i] = i; - std::random_shuffle(ic, ic+2*N); + std::shuffle(ic, ic+2*N, randomness); std::copy(ic, ic+N, ia); std::copy(ic+N, ic+2*N, ib); std::sort(ia, ia+N); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.merge/merge_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -22,11 +22,14 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #include "test_iterators.h" #include "counting_predicates.hpp" +std::mt19937 randomness; + template <class InIter1, class InIter2, class OutIter> void test() @@ -61,7 +64,7 @@ test() int* ic = new int[2*N]; for (unsigned i = 0; i < 2*N; ++i) ic[i] = i; - std::random_shuffle(ic, ic+2*N); + std::shuffle(ic, ic+2*N, randomness); std::copy(ic, ic+N, ia); std::copy(ic+N, ic+2*N, ib); std::sort(ia, ia+N, std::greater<int>()); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element.pass.cpp Tue Feb 7 12:41:25 2017 @@ -15,10 +15,13 @@ // max_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) @@ -40,7 +43,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; } Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/max_element_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,11 +16,14 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #include "test_macros.h" #include "test_iterators.h" +std::mt19937 randomness; + template <class Iter> void test(Iter first, Iter last) @@ -42,7 +45,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; } Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element.pass.cpp Tue Feb 7 12:41:25 2017 @@ -15,10 +15,13 @@ // min_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) @@ -40,7 +43,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; } Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/min_element_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,11 +16,14 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #include "test_macros.h" #include "test_iterators.h" +std::mt19937 randomness; + template <class Iter> void test(Iter first, Iter last) @@ -42,7 +45,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; } Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element.pass.cpp Tue Feb 7 12:41:25 2017 @@ -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); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/minmax_element_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,11 +16,14 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #include "test_macros.h" #include "test_iterators.h" +std::mt19937 randomness; + template <class Iter> void test(Iter first, Iter last) @@ -50,7 +53,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; } @@ -70,7 +73,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); typedef std::greater<int> Compare; Compare comp; std::pair<Iter, Iter> p = std::minmax_element(Iter(a), Iter(a+N), comp); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,8 +16,11 @@ // nth_element(Iter first, Iter nth, Iter last); #include <algorithm> +#include <random> #include <cassert> +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 Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -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 Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp Tue Feb 7 12:41:25 2017 @@ -18,10 +18,13 @@ // partial_sort_copy(InIter first, InIter last, RAIter result_first, RAIter result_last); #include <algorithm> +#include <random> #include <cassert> #include "test_iterators.h" +std::mt19937 randomness; + template <class Iter> void test_larger_sorts(int N, int M) @@ -30,7 +33,7 @@ test_larger_sorts(int N, int M) int* output = new int[M]; for (int i = 0; i < N; ++i) input[i] = i; - std::random_shuffle(input, input+N); + std::shuffle(input, input+N, randomness); int* r = std::partial_sort_copy(Iter(input), Iter(input+N), output, output+M); int* e = output + std::min(N, M); assert(r == e); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -21,10 +21,13 @@ #include <algorithm> #include <functional> +#include <random> #include <cassert> #include "test_iterators.h" +std::mt19937 randomness; + template <class Iter> void test_larger_sorts(int N, int M) @@ -33,7 +36,7 @@ test_larger_sorts(int N, int M) int* output = new int[M]; for (int i = 0; i < N; ++i) input[i] = i; - std::random_shuffle(input, input+N); + std::shuffle(input, input+N, randomness); int* r = std::partial_sort_copy(Iter(input), Iter(input+N), output, output+M, std::greater<int>()); int* e = output + std::min(N, M); Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,8 +16,11 @@ // partial_sort(Iter first, Iter middle, Iter last); #include <algorithm> +#include <random> #include <cassert> +std::mt19937 randomness; + void test_larger_sorts(int N, int M) { @@ -26,7 +29,7 @@ test_larger_sorts(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::partial_sort(array, array+M, array+N); for (int i = 0; i < M; ++i) { Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/partial.sort/partial_sort_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -18,6 +18,7 @@ #include <algorithm> #include <vector> #include <functional> +#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_larger_sorts(int N, int M) { @@ -40,7 +43,7 @@ test_larger_sorts(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::partial_sort(array, array+M, array+N, std::greater<int>()); for (int i = 0; i < M; ++i) { Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp Tue Feb 7 12:41:25 2017 @@ -17,8 +17,11 @@ #include <algorithm> #include <iterator> +#include <random> #include <cassert> +std::mt19937 randomness; + template <class RI> void test_sort_helper(RI f, RI l) @@ -92,7 +95,7 @@ test_larger_sorts(int N, int M) std::sort(array, array+N); assert(std::is_sorted(array, array+N)); // test random pattern - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::sort(array, array+N); assert(std::is_sorted(array, array+N)); // test sorted pattern Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort.pass.cpp Tue Feb 7 12:41:25 2017 @@ -17,8 +17,11 @@ #include <algorithm> #include <iterator> +#include <random> #include <cassert> +std::mt19937 randomness; + template <class RI> void test_sort_helper(RI f, RI l) @@ -92,7 +95,7 @@ test_larger_sorts(int N, int M) std::stable_sort(array, array+N); assert(std::is_sorted(array, array+N)); // test random pattern - std::random_shuffle(array, array+N); + std::shuffle(array, array+N, randomness); std::stable_sort(array, array+N); assert(std::is_sorted(array, array+N)); // test sorted pattern Modified: libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp (original) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.sort/stable.sort/stable_sort_comp.pass.cpp Tue Feb 7 12:41:25 2017 @@ -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; + struct first_only { bool operator()(const std::pair<int, int>& x, const std::pair<int, int>& y) @@ -59,7 +62,7 @@ void test() } for (int i = 0; i < N - M; i += M) { - std::random_shuffle(v.begin() + i, v.begin() + i + M); + std::shuffle(v.begin() + i, v.begin() + i + M, randomness); } std::stable_sort(v.begin(), v.end(), first_only()); assert(std::is_sorted(v.begin(), v.end())); Modified: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort.pass.cpp Tue Feb 7 12:41:25 2017 @@ -15,10 +15,13 @@ #include <iterator> #include <algorithm> #include <vector> +#include <random> #include <cassert> #include "min_allocator.h" +std::mt19937 randomness; + template <class C> void test(int N) { @@ -27,7 +30,7 @@ void test(int N) V v; for (int i = 0; i < N; ++i) v.push_back(i); - std::random_shuffle(v.begin(), v.end()); + std::shuffle(v.begin(), v.end(), randomness); C c(v.begin(), v.end()); c.sort(); assert(distance(c.begin(), c.end()) == N); Modified: libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp?rev=294328&r1=294327&r2=294328&view=diff ============================================================================== --- libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.ops/sort_pred.pass.cpp Tue Feb 7 12:41:25 2017 @@ -16,10 +16,13 @@ #include <algorithm> #include <vector> #include <functional> +#include <random> #include <cassert> #include "min_allocator.h" +std::mt19937 randomness; + template <class C> void test(int N) { @@ -28,7 +31,7 @@ void test(int N) V v; for (int i = 0; i < N; ++i) v.push_back(i); - std::random_shuffle(v.begin(), v.end()); + std::shuffle(v.begin(), v.end(), randomness); C c(v.begin(), v.end()); c.sort(std::greater<T>()); assert(distance(c.begin(), c.end()) == N); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits