1 /* Copyright (C) 2016 Edward Diener
3 * Use, modification and distribution is subject to the
4 * Boost Software License, Version 1.0. (See accompanying
5 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_POOL_TEST_RANDOM_SHUFFLE_HPP
9 #define BOOST_POOL_TEST_RANDOM_SHUFFLE_HPP
15 template< class RandomIt >
16 void pool_test_random_shuffle( RandomIt first, RandomIt last )
18 typename std::iterator_traits<RandomIt>::difference_type i, n;
20 for (i = n-1; i > 0; --i) {
22 swap(first[i], first[std::rand() % (i+1)]);
26 #endif // BOOST_POOL_TEST_RANDOM_SHUFFLE_HPP