1 #ifndef BOOST_MOVE_TEST_RANDOM_SHUFFLE_HPP
2 #define BOOST_MOVE_TEST_RANDOM_SHUFFLE_HPP
5 #include <boost/move/adl_move_swap.hpp>
6 #include <boost/move/detail/iterator_traits.hpp>
9 template< class RandomIt >
10 void random_shuffle( RandomIt first, RandomIt last )
12 typedef typename boost::movelib::iterator_traits<RandomIt>::difference_type difference_type;
13 difference_type n = last - first;
14 for (difference_type i = n-1; i > 0; --i) {
15 difference_type j = std::rand() % (i+1);
17 boost::adl_move_swap(first[i], first[j]);
23 #endif// BOOST_MOVE_TEST_RANDOM_SHUFFLE_HPP