Skip to content

Instantly share code, notes, and snippets.

@bor0
Created September 3, 2023 16:04
Show Gist options
  • Save bor0/efc4ade82d4e41c9133ab20952ec9c0e to your computer and use it in GitHub Desktop.
Save bor0/efc4ade82d4e41c9133ab20952ec9c0e to your computer and use it in GitHub Desktop.
import random
tries = 12345
def calc_days(seeds):
days = 0
trees = 0
while trees <= seeds:
days += 1
for i in range(0, seeds): # for each seed
trees += random.randint(0, 1) # 50% chance
return days
avg = 0
for i in range(0, tries):
avg += calc_days(6)
avg /= tries
print(avg)
@bor0
Copy link
Author

bor0 commented Jan 10, 2024

Screenshot 2024-01-18 at 12 23 32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment