thm
"cpp/header/algorithm") `  
---  
[ reverse  ](/w/cpp/algorithm/reverse "cpp/algorithm/reverse") |  reverses the order of elements in a range   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/dsc_reverse&action=edit)  
[ ranges::reverse  ](/w/cpp/algorithm/ranges/reverse "cpp/algorithm/ranges/reverse") (C++20)  |  reverses the order of elements in a range   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_reverse&action=edit)  
[ reverse_copy  ](/w/cpp/algorithm/reverse_copy "cpp/algorithm/reverse copy") |  creates a copy of a range that is reversed   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/dsc_reverse_copy&action=edit)  
[ ranges::reverse_copy  ](/w/cpp/algorithm/ranges/reverse_copy "cpp/algorithm/ranges/reverse copy") (C++20)  |  creates a copy of a range that is reversed   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_reverse_copy&action=edit)  
[ rotate  ](/w/cpp/algorithm/rotate "cpp/algorithm/rotate") |  rotates the order of elements in a range   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/dsc_rotate&action=edit)  
[ ranges::rotate  ](/w/cpp/algorithm/ranges/rotate "cpp/algorithm/ranges/rotate") (C++20)  |  rotates the order of elements in a range   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_rotate&action=edit)  
[ rotate_copy  ](/w/cpp/algorithm/rotate_copy "cpp/algorithm/rotate copy") |  copies and rotate a range of elements   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/dsc_rotate_copy&action=edit)  
[ ranges::rotate_copy  ](/w/cpp/algorithm/ranges/rotate_copy "cpp/algorithm/ranges/rotate copy") (C++20)  |  copies and rotate a range of elements   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_rotate_copy&action=edit)  
[ shift_left  shift_right  ](/w/cpp/algorithm/shift "cpp/algorithm/shift") (C++20)  |  shifts elements in a range   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/dsc_shift&action=edit)  
[ random_shuffle  shuffle  ](/w/cpp/algorithm/random_shuffle "cpp/algorithm/random shuffle") (until C++17)  (C++11)  |  randomly re-orders elements in a range   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/dsc_random_shuffle&action=edit)  
[ ranges::shuffle  ](/w/cpp/algorithm/ranges/shuffle "cpp/algorithm/ranges/shuffle") (C++20)  |  randomly re-orders elements in a range   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_shuffle&action=edit)  
[ ranges::shift_left  ranges::shift_right  ](/w/cpp/algorithm/ranges/shift "cpp/algorithm/ranges/shift") (C++23)  |  shifts elements in a range   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_shift&action=edit)  
  
####  [ [ edit ](/mwiki/index.php?title=cpp/algorithm&action=edit&section=14
"Edit section: Sampling operations") ]  Sampling operations

Defined in header ` [ <algorithm> ](/w/cpp/header/algorithm
"cpp/header/algorithm") `  
---  
[ sample  ](/w/cpp/algorithm/sample "cpp/algorithm/sample") (C++17)  |  selects N random elements from a sequence   
(function template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/dsc_sample&action=edit)  
[ ranges::sample  ](/w/cpp/algorithm/ranges/sample "cpp/algorithm/ranges/sample") (C++20)  |  selects N random elements from a sequence   
(niebloid)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/algorithm/ranges/dsc_sample&action=edit)