Created
July 27, 2013 08:07
-
-
Save juliandescottes/6094200 to your computer and use it in GitHub Desktop.
Birthday problem - in javascript \o/ cf http://en.wikipedia.org/wiki/Birthday_problem
This file contains 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
// PARADOX ! Inception-style | |
var paradox = function(setSize,p){ | |
Math.sqrt(2*setSize*Math.log(1/(1-p))) | |
}; | |
// So that's the generic formula. | |
// Applied to the usual "over 50% of prob to have 2 people with the same birthday" | |
paradox(365, 0.5); // => 22.49 |
jdspugh
commented
Jul 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment