Skip to content

Instantly share code, notes, and snippets.

@fabiom
Last active April 7, 2021 00:36
Show Gist options
  • Save fabiom/2d2b73be023beb81fa7e9d5f95bc90aa to your computer and use it in GitHub Desktop.
Save fabiom/2d2b73be023beb81fa7e9d5f95bc90aa to your computer and use it in GitHub Desktop.
Returns the probability of two people out of n having the same birthday.
function BirthdayParadox(n)
# Returns the probability of two people out of n having the same birthday.
1-prod( ((365-n+1):365.0) /365.0 )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment