bug-coreutils
[Top][All Lists]
Advanced

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

Re: feature request: sleep --random


From: Philip Rowlands
Subject: Re: feature request: sleep --random
Date: Fri, 18 Sep 2009 15:02:45 +0100 (BST)
User-agent: Alpine 1.10 (DEB 962 2008-03-14)

On Fri, 18 Sep 2009, Pádraig Brady wrote:

Pádraig Brady wrote:
sleep $(seq .1 .1 4 | head -n $(($RANDOM%40 +1)) | tail -n1)

Or more concisely using just coreutils logic:

sleep $(seq .1 .1 4 | shuf | head -n1)

This still has the quantization effects which I'm trying to avoid. Jim's perl suggestion would work well to ensure an even spread over the window of time.

$ perl -e 'sleep rand 4'

is probably the cleanest / most efficient way to do this with existing tools.


Cheers,
Phil




reply via email to

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