In probability theory, the birthday problem or birthday paradox concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday. By the pigeonhole principle, the probability reaches 100% when the number of people reaches 367 (since there are only 366 possible birthdays, including February 29). However, 99.9% probability is reached with just 70 people, and 50% probability with 23 people.
Not sure why The Birthday Problem blows my mind, but it got under my skin today, and I just HAD to make a visual representation of it. Press [Z] to generate a birthday for each of the 70 cakes. Each cake is assigned a value between 1 and 366 (1 for each day of the year). If there are two matching birthdays, their candles light up! If you want to see it represented numerically instead of visually, press [X]!
Thanks for checking it out, Felice!
I'd considered adding the option to change the sample size, but the 70-person 99.9% probability was honestly the only representation that I cared to see. It just seemed like such a mind-boggling statistic that I wanted to make a program to see for myself if it was true. :P
:P I'll do it myself, then.
You can adjust the number from 0-96 now.
I also changed it so it color-codes the matches in reveal mode and makes the candles brighter for greater numbers of matches. Had to change the code/data structure a bunch for this, though.
There's also an easter egg. Hint: It's easiest with just two cakes, but I'll be impressed if anyone has the patience to do it with more.
[Please log in to post a comment]