-
-
Save rust-play/d92db4884037c57c7d3056f65f3c605e to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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
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