Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import *
- #w is just p**0.5
- def findRuns(p):
- #i = randint(0, p-1)
- i = randint(0, ceil(w))
- count = 0
- while i < w:
- #i = randint(i+1, p)
- i = randint(i+1, ceil(w))
- count = count + 1
- return count
- #running average
- def rAvg(p, limit = 100):
- i = 0
- result = 0
- while i < limit:
- result = result + findRuns(p)
- i = i + 1
- print(f"avg: {result/i}")
- return result/i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement