Reading Time: < 1 minute
If you want to insert a sleep in a script for a random number of seconds, you can do the following:
NUMBER=$[ ( $RANDOM % 60 ) + 1 ]
sleep $NUMBER
Replace 60 with the interval chosen and you will get a random sleep between 1 and 60 seconds.
This can be useful if you are trying to fetch data from a server who’s monitoring the number of connections you are opening and tends to blacklist you if you do too much.