stlab.adobe.com Adobe Systems Incorporated
random_shuffle.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2005-2007 Adobe Systems Incorporated
3  Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
4  or a copy at http://stlab.adobe.com/licenses.html)
5 */
6 
7 /*************************************************************************************************/
8 
9 #ifndef ADOBE_ALGORITHM_RANDOM_SHUFFLE_HPP
10 #define ADOBE_ALGORITHM_RANDOM_SHUFFLE_HPP
11 
12 #include <adobe/config.hpp>
13 
14 #include <boost/range/begin.hpp>
15 #include <boost/range/end.hpp>
16 #include <boost/bind.hpp>
17 
18 #include <algorithm>
19 
20 /*************************************************************************************************/
21 
22 namespace adobe {
23 
24 /*************************************************************************************************/
32 /*************************************************************************************************/
38 template <class RandomAccessRange>
39 inline void random_shuffle(RandomAccessRange& range)
40 {
41  return std::random_shuffle(boost::begin(range), boost::end(range));
42 }
43 
49 template <class RandomAccessIterator, class RandomNumberGenerator>
50 inline void
51 random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator& rand)
52 {
53  return std::random_shuffle(first, last, boost::bind(rand, _1));
54 }
55 
61 template <class RandomAccessRange, class RandomNumberGenerator>
62 inline void random_shuffle(RandomAccessRange& range, RandomNumberGenerator& rand)
63 {
64  return adobe::random_shuffle(boost::begin(range), boost::end(range), rand);
65 }
66 
67 /*************************************************************************************************/
68 
69 } // namespace adobe
70 
71 /*************************************************************************************************/
72 
73 #endif
74 
75 /*************************************************************************************************/
void random_shuffle(RandomAccessRange &range, RandomNumberGenerator &rand)
random_shuffle implementation
void random_shuffle(RandomAccessRange &range)
random_shuffle implementation

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google