Last active
August 29, 2015 14:12
-
-
Save jrandom/b4dd0d0f8200217c44d1 to your computer and use it in GitHub Desktop.
Revisions
-
jrandom revised this gist
Dec 25, 2014 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,11 +2,14 @@ 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); } } -
jrandom revised this gist
Dec 24, 2014 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,12 @@ template < typename container_t > void BogoSort( container_t & data ) { std::random_device rd; std::mt19937 ung( rd() ); while( !std::is_sorted(std::begin(data), std::end(data)) ) { std::shuffle(std::begin(data), std::end(data), ung); } } -
jrandom created this gist
Dec 23, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ template < typename value_t > void BogoSort( std::vector< value_t > & data ) { while( !std::is_sorted(data.cbegin(), data.cend()) ) { std::random_shuffle(data.begin(), data.end()); } }