Advertisement
Guest User

logarithm

a guest
Nov 29th, 2021
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. from random import *
  2.  
  3. #w is just p**0.5
  4.  
  5. def findRuns(p):
  6.   #i = randint(0, p-1)
  7.   i = randint(0, ceil(w))
  8.   count = 0
  9.   while i < w:
  10.     #i = randint(i+1, p)
  11.     i = randint(i+1, ceil(w))
  12.     count = count + 1
  13.   return count
  14.  
  15. #running average
  16. def rAvg(p, limit = 100):
  17.   i = 0
  18.   result = 0
  19.   while i < limit:
  20.     result = result + findRuns(p)
  21.     i = i + 1
  22.     print(f"avg: {result/i}")
  23.  
  24.   return result/i
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement