Is there a reverse way to find number of people with given 0.5 probability that two people will have same birthday but no using mathematical formula?
问题 I'm doing birthday paradox, and want to know how many people can meet 0.5 probability that two people have same birthday by using python. I have tried no using mathematical formula to find probability with given the number of people by using random and randint in python import random def random_birthdays(): bdays = [] bdays = [random.randint(1, 365) for i in range(23)] bdays.sort() for x in range(len(bdays)): while x < len(bdays)-1: print x if bdays[x] == bdays[x+1]: #print(bdays[x]) return