This file contains hidden or 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 rand::Rng; | |
| fn flip_coin() -> Vec<bool> { | |
| let mut rng = rand::thread_rng(); | |
| let mut results = Vec::new(); | |
| // Simulate 100 coin flips and store the boolean result | |
| for _ in 0..100 { | |
| let coin_flip = rng.gen_bool(0.5); // true for "Heads", false for "Tails" | |
| results.push(coin_flip); |
This file contains hidden or 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 rand::Rng; | |
| fn flip_coin() -> Vec<bool> { | |
| let mut rng = rand::thread_rng(); | |
| let mut results = Vec::new(); | |
| // Simulate 100 coin flips and store the boolean result | |
| for _ in 0..100 { | |
| let coin_flip = rng.gen_bool(0.5); // true for "Heads", false for "Tails" | |
| results.push(coin_flip); |