Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- from timeit import default_timer as timer
- start = timer()
- y = [0]
- x = 1
- f = 1000000
- g = 500
- z = y[:-1]
- d = {}
- tot = 0
- rolls = 0
- rollsmax = 0
- rollsmin = 0
- highroll = 0
- lowroll = None
- highkey = 0
- lowkey = 0
- hightime = 0
- lowtime = None
- hightimekey = 0
- lowtimekey = 0
- trange = 0
- while y[-1] < g:
- x = random.randint(1, f)
- a = len(str(x))
- b = 4 - a
- z = y[-1]
- rolls += 1
- if x in d:
- d[x] += 1
- else:
- d[x] = 1
- if x == z + 1:
- y.append(x)
- end = timer()
- print(x, ':', rolls)
- if rolls > highroll:
- highroll = rolls
- highkey = y[-1]
- print('The Highest Current Roll was: ', highroll,', for key number: ', highkey)
- if lowroll is None:
- lowroll = rolls
- lowkey = y[-1]
- print('The Lowest Current Roll was: ', lowroll,', for key number: ', lowkey)
- if rolls < lowroll:
- lowroll = rolls
- lowkey = y[-1]
- print('The Lowest Current Roll was: ', lowroll,', for key number: ', lowkey)
- kend = end - start
- if kend > hightime:
- hightime = kend
- hightimekey = y[-1]
- if lowtime is None:
- lowtime = kend
- lowtimekey = y[-1]
- if kend < lowtime:
- lowtime = kend
- lowtimekey = y[-1]
- rolls = 0
- tot += 1
- averagerolls = tot / g
- ending = timer()
- averagetime = (ending - start) / g
- rrange = highroll - lowroll
- trange = hightime - lowtime
- print('Total Rolls is:', tot, ', Total Time is', (ending - start))
- print('The Average number of rolls was:', averagerolls)
- print('The average time was', (averagetime))
- print('The Highest Roll was: ', highroll,', for key number: ', highkey)
- print('The Lowest Roll was: ', lowroll,', for key number: ', lowkey)
- print('Roll Range was', rrange)
- print('The Longest Roll Time was: ', hightime,', for key number: ', hightimekey)
- print('The Shortest Roll Time was: ', lowtime,', for key number: ', lowtimekey)
- print('The Time Range was:', trange)
Add Comment
Please, Sign In to add comment