Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created April 7, 2022 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/d92db4884037c57c7d3056f65f3c605e to your computer and use it in GitHub Desktop.
Save rust-play/d92db4884037c57c7d3056f65f3c605e to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use itertools::Itertools;
use rand::prelude::SliceRandom; // 0.8.5 // 0.10.3
fn main() {
let mut rng = rand::thread_rng();
let items = (0..9)
.cartesian_product(0..9)
.collect::<Vec<(usize, usize)>>();
let possible_locations = items.choose_multiple(&mut rng, 2);
for location in possible_locations {
dbg!(location);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment