working version
This commit is contained in:
16
src/main.rs
Normal file
16
src/main.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use rand::seq::IndexedRandom;
|
||||
use rand::RngExt;
|
||||
|
||||
const WORDS: &str = include_str!("../words.txt");
|
||||
|
||||
fn main() {
|
||||
let words: Vec<&str> = WORDS.lines().collect();
|
||||
|
||||
let mut rng = rand::rng();
|
||||
|
||||
let word = words.choose(&mut rng).expect("word list is empty");
|
||||
|
||||
let number = rng.random_range(0..10000);
|
||||
|
||||
println!("{}{:04}", word, number);
|
||||
}
|
||||
Reference in New Issue
Block a user