use rand::{Rng, thread_rng};
      use rand::distributions::Alphanumeric;
      use rayon::prelude::*;
      
      fn main() {
        let mut vec = vec![String::new(); 100_000];
        vec.par_iter_mut().for_each(|p| {
          let mut rng = thread_rng();
          *p = (0..5).map(|_| rng.sample(&Alphanumeric)).collect()
        });
        vec.par_sort_unstable();
      }
      
      Rust language logo

      Sort in parallel

      Codiga's Rust Recipes

      sort a vector

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.