]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/doc/reference/algorithm/random_shuffle.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / range / doc / reference / algorithm / random_shuffle.qbk
1 [/
2 Copyright 2010 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 /]
6 [section:random_shuffle random_shuffle]
7
8 [heading Prototype]
9
10 ``
11 template<class RandomAccessRange>
12 RandomAccessRange& random_shuffle(RandomAccessRange& rng);
13
14 template<class RandomAccessRange>
15 const RandomAccessRange& random_shuffle(const RandomAccessRange& rng);
16
17 template<class RandomAccessRange, class Generator>
18 RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen);
19
20 template<class RandomAccessRange, class Generator>
21 const RandomAccessRange& random_shuffle(const RandomAccessRange& rng, Generator& gen);
22 ``
23
24 [heading Description]
25
26 `random_shuffle` randomly rearranges the elements in `rng`. The versions of `random_shuffle` that do not specify a `Generator` use an internal random number generator. The versions of `random_shuffle` that do specify a `Generator` use this instead. Returns the shuffles range.
27
28 [heading Definition]
29
30 Defined in the header file `boost/range/algorithm/random_shuffle.hpp`
31
32 [heading Requirements]
33
34 [*For the version without a Generator:]
35
36 * `RandomAccessRange` is a model of the __random_access_range__ Concept.
37
38 [*For the version with a Generator:]
39
40 * `RandomAccessRange` is a model of the __random_access_range__ Concept.
41 * `Generator` is a model of the `RandomNumberGeneratorConcept`.
42 * `RandomAccessRange`'s distance type is convertible to `Generator`'s argument type.
43
44 [heading Precondition:]
45
46 * `distance(rng)` is less than `gen`'s maximum value.
47
48
49 [heading Complexity]
50
51 Linear. If `!empty(rng)`, exactly `distance(rng) - 1` swaps are performed.
52
53 [endsect]
54
55