Skip to content

Instantly share code, notes, and snippets.

View agaskell's full-sized avatar

Andy Gaskell agaskell

View GitHub Profile
@agaskell
agaskell / main.rs
Created September 13, 2024 02:24
Coinflippers any
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);
@agaskell
agaskell / main.rs
Last active September 13, 2024 02:23
Coinflippers consecutive
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);