xyzio

Wait a random delay in Python

leave a comment »

Wait a random interval in seconds between 0 and delay.

import random
import time

timeDelay = random.randrange(0, delay)
time.sleep(timeDelay)

Written by M Kapoor

February 4, 2017 at 1:33 am

Posted in python

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: