[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature request: sleep --random
From: |
Pádraig Brady |
Subject: |
Re: feature request: sleep --random |
Date: |
Fri, 18 Sep 2009 15:27:56 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Philip Rowlands wrote:
> 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.
right.
Note the scheduler is still going to quantize your sleep values,
so in practicality your probably not going to get smoother than:
sleep $(seq .002 .002 4 | shuf | head -n1)
cheers,
Pádraig.
p.s. That's another use case for sort --range