Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Davies iamed2

  • Invenia Technical Computing
  • Winnipeg, MB, Canada
View GitHub Profile
@iamed2
iamed2 / odds.jl
Created Nov 1, 2021
Calculate the experimental odds of snake eyes if you're told "at least one of them is a one"
View odds.jl
function tally(n=100)
snake_eyes = 0
any_ones = 0
for i in 1:n
rolls = (dice_roll(), dice_roll())
if 1 in rolls # tests at least one of them is a one
any_ones += 1
if rolls[1] == rolls[2] # tests both are one