coreutils
[Top][All Lists]
Advanced

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

Re: sort/shuf/shred: support fixed random-seed


From: Pádraig Brady
Subject: Re: sort/shuf/shred: support fixed random-seed
Date: Sat, 07 Feb 2015 11:53:24 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 07/02/15 02:13, Assaf Gordon wrote:
> Hello,
> 
> Attached is a proof-of-concept implementation supporting '--random=seed=N' 
> option for sort/shuf/shred,
> to enable reproducible (pseudo) random runs.
> It was discussed a while ago, here:
> http://lists.gnu.org/archive/html/coreutils/2013-11/msg00068.html
> 
> comments are welcomed,

Reproducibility is a useful though not often required goal.
Playing devil's advocate, you could get it with:

  get_random() { seed="$1"; openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt 
</dev/zero 2>/dev/null; }

  shuf -i1-100 --random-source=<(get_random 42)

While a separate dependency, it's widely available and we could document it.

The advantage is that it's an existing mechanism
and uses more silicon to generate the random numbers.

cheers,
Pádraig.





reply via email to

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