Traditional Culture Encyclopedia - Weather forecast - Solving "Birthday Paradox" with python Programming
Solving "Birthday Paradox" with python Programming
Random import
def bdp(n,k):
cv = []
For I in the range (k):
m = []
For j in the range (n):
m . append(random . randint( 1,365))
Counter = 0
For k 1 in m:
For k2 in m:
If k 1 == k2:
Counter += 1
cv . append(float(counter/2)/float(n))
ss = 0
For I in cv:
ss += i
Back to ss/float(len(cv))
You can use Pro-test:
- Related articles
- The weather in Tianshui is calm
- What's the weather like in Algeria?
- What clothes are suitable for nine degrees weather?
- Proverbs about weather! Speed!
- The weather in Shanghai these two days
- Why don't you send a short message about the weather forecast?
- Always out of breath, chest pain, weakness. What happened?
- Cold waves hit everywhere. What measures do you have to keep out the cold?
- The answer to the wizard's Kunte grass test
- What is the pinyin number of Chufrost? 202 1.