-
-
Save claudiouzelac/54e5794b384cc7bda9d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template < typename container_t > | |
| void BogoSort( container_t & data ) | |
| { | |
| using std::begin; | |
| using std::end; | |
| std::random_device rd; | |
| std::mt19937 ung( rd() ); | |
| while( !std::is_sorted(begin(data), end(data)) ) | |
| { | |
| std::shuffle(begin(data), end(data), ung); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment