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()); | |
} | |
} |
![show me the code.jpeg](https://gist.github.com/ggssh/278512d414a04f73845988fb3e898903/raw/ac28244b3b429a26dec2815ffc5c5896e061af41/show%2520me%2520the%2520code.jpeg)
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
extern crate rand; | |
use rand::Rng; | |
use std::thread::{self, JoinHandle}; | |
use std::time::Duration; | |
fn main() { | |
let mut v = Vec::<i32>::new(); | |
let mut rng = rand::thread_rng(); | |
for _ in 1..10 { |