##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::shuffle

From cppreference.com
< cpp‎ | experimental

Defined in header `<experimental/algorithm>` |  |
template< class RandomIt> void shuffle( RandomIt first, RandomIt last); |  | (library fundamentals TS v2)

Reorders the elements in the given range `[first, last)` such that each possible permutation of those elements has equal probability of appearance, using the per-thread random number engine as the random number generator.

### [edit] Parameters

first, last | - | the range of elements to shuffle randomly
- `RandomIt` must meet the requirements of `ValueSwappable` and `RandomAccessIterator`.

### [edit] Return value

(none)

### [edit] Complexity

Linear in the distance between `first` and `last`.

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

random_shuffle shuffle (until C++17)(C++11) | randomly re-orders elements in a range (function template) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/shuffle&oldid=81729"
Category:

- Todo no example