Random boolean in Rust Prerequisites [dependencies] rand = "0.8.5" Usage example use rand::Rng; let mut rng = rand::thread_rng(); let choice: bool = rng.gen(); // This is the random value
this won't work in rust 2024, as a head's up.
rng
changed the api and the rust lang team reserved thegen
keyword.