Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created April 7, 2022 12:19
Embed
What would you like to do?
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