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: Mon, 09 Feb 2015 17:22:04 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 07/02/15 11:53, Pádraig Brady wrote:
> 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.

No counter arguments, which is surprising.
Anyway personally I prefer the --random-seed option
as it's neater, has less deps, and is about 10% faster even with hardware 
assist.

As for the --random-seed interface.
Should we be supplying a string rather than an int?
At least we need to cater for endianness issues with an int,
but a string might be easier to use.

thanks,
Pádraig.




reply via email to

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