Skip to content

Instantly share code, notes, and snippets.

@jboockmann
jboockmann / UniformSumDistribution.py
Created May 8, 2018 22:05
The average number of random numbers between 0 and 1 that must be added for a sum of at least 1 is e. http://mathworld.wolfram.com/UniformSumDistribution.html
#!/usr/bin/env python2.7
# https://twitter.com/tweetsauce/status/993577516513165312
# The average number of random numbers between 0 and 1 that must be added for a sum of at least 1 is e. http://mathworld.wolfram.com/UniformSumDistribution.html
import random
iterations = 100000
numbers = []