[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: sleep --random

From: Jim Meyering
Subject: Re: feature request: sleep --random
Date: Fri, 18 Sep 2009 13:41:11 +0200

Philip Rowlands wrote:
> This would help with some work I'm doing today, but is it of general
> interest?
> $ sleep --random 4.0
> sleeps for a random amount of time up to and including the requested
> value. The purpose is that on distributed systems it's disruptive to
> have synchronized scripts all starting up together. One option is to
> use the shell's $RANDOM if available, but it's lot of typing to get
> true (vs coarsely quantized) randomness.

How about this:

  sleep $(perl -le 'print rand 4')

That should work with more shells, and is smooth.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]