while true; do date; sleep `rand -s $(date +%N) -M 30`; done

From man rand:

-s number
       the seed for the random numbers generator (default time(NULL))
-M, --max number
       the limit of the random numbers (default 32576)

By setting the seed to date +%N (nanoseconds) we can avoid getting multiple zeros out of rand.

Spread the word!

share on Hacker News