Created
July 28, 2023 02:39
-
-
Save ggssh/3e3b45292cde45c944ce66ff4e2a8b94 to your computer and use it in GitHub Desktop.
Monkey Sort
This file contains 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
fn monkey_sort<T: Ord>(arr: &mut [T]) { | |
while !is_sorted(arr) { | |
arr.shuffle(&mut rand::thread_rng()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment