Log In  


Cart #53366 | 2018-06-08 | Code ▽ | Embed ▽ | No License
8

From Wikipedia:
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]!

8


Wow, I knew about the odds of there being no match got low rapidly as the sample size rose, but I didn't know it was already 1/1000 at 70 people.

Neat!


As an aside, you should allow the user to change the sample size, within a reasonable range.


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


2

: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.

Cart #53429 | 2018-06-09 | Code ▽ | Embed ▽ | No License
2


this is a cool visualization! probability is so crazy and unintuitive

lol @ Felice's easter egg XD (got it with 2 cakes)


Thanks kittenm4ster! :)



[Please log in to post a comment]