I am trying to use the code:
import random
import datetime
from sched import scheduler
from time import time, sleep
s = scheduler(time, sleep)
random.seed()
def run_periodically(start, end, interval, func):
event_time = start
while event_time < end:
s.enterabs(event_time, 0, func, ())
event_time += interval + random.random(-5, 45)
s.run()
getData()#######
run_periodically(time()+5, time()+1000000, 10, getData)
I am trying to get the scheduled time and or the scheduled interval to have some degree of randomisation, currently the code returns the
typeError: random() takes no arguments (2 given)
If anyone could either tell me how to fix this or provide an alternative method it would be greatly appreciated.