4 ms·
Very true. In a group of 23 randomly selected people, there is just over 50% chance that two share the same birthday. Two great articles about this: http://en.
by pierrefar 18y ago
Very true. In a group of 23 randomly selected people, there is just over 50% chance that two share the same birthday. Two great articles about this:
http://en.wikipedia.org/wiki/Birthday_paradox http://en.wikipedia.org/wiki/Birthday_paradox
http://mathforum.org/dr.math/faq/faq.birthdayprob.html http://mathforum.org/dr.math/faq/faq.birthdayprob.html
Don't tell that to astrologers, otherwise they might make Mars align with Jupiter and that will crash your code with an unknown exception.
- delano 18y agoAn astrologer may also tell you the moon is in void of course and to wait until tomorrow to make your release :]
- param 18y agoThe funniest example of how that's just probability was when this problem was discussed in my bachelor's class of about 60 people, and the prof confidently starts asking us for our dates of birth, and there was not even 1 matching pair. The probability is apparently around .01%
- swillden 18y ago365! / ((365-60)! 365^60) = 0.0059 So it's about 1%, assuming uniform distribution of birthdays. Since they're not quite uniformly distributed, the actual odds of 60 people with no common birthdays is a little lower than that. However, given the thousands of people reading HN who experienced such a classroom exercise, the odds are very good that someone like you will pipe up ;-)
- jonknee 18y agoWe discussed this in an Algebra class during highschool--she actually sat us by birthdate. Turns out two people shared my birthday and she made us take out our IDs because she thought it was some sort of ruse. 10% of the class with the same birthday is a bit odd, but we all had fun calculating the actual odds.
- paulgb 18y agoOut of curiosity, how did the class determine whether anyone shared a birthday? The best way I can think of is lining up by order and then seeing if your neighbors share your birthday. Is that how you did it? Is there a better way to do it?
- param 18y agoeveryone says out their birthday in order of seating(randomly seated). If someone hears their birthday, they shout out of turn. I guess you were expecting an algorithm faster than O(n)? That was the best we could do, given n processors with O(1) space each :-D