[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sort/shuf/shred: support fixed random-seed
From: |
Bernhard Voelker |
Subject: |
Re: sort/shuf/shred: support fixed random-seed |
Date: |
Tue, 10 Feb 2015 08:44:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 02/09/2015 10:06 PM, Pádraig Brady wrote:
> --- a/doc/coreutils.texi
> +++ b/doc/coreutils.texi
> @@ -1240,6 +1240,21 @@ operating system.
> To reproduce the results of an earlier invocation of a command, you
> can save some random data into a file and then use that file as the
> random source in earlier and later invocations of the command.
> +@cindex random seed
> +Rather than depending on a file, one can generate a reproducible
> +arbitrary amount of pseudo-random data given a seed value, using
> +for example:
> +
The whole point of reproducibility here is that the --random-source file
is constant, i.e., that the openssl command always produces the same
output. This is not that clear to me in the above sentence.
Maybe clarify this in a comment?
> +@example
> +get_random()
> +@{
> + seed="$1"
+ # Given the same $seed, the following produces reproducible
+ # output of arbitrary length.
> + openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt \
> + </dev/zero 2>/dev/null
> +@}
> +
> +shuf -i1-100 --random-source=<(get_random 42)
> +@end example
>
> @node Target directory
> @section Target directory
> -- 2.1.0
Thanks & have a nice day,
Berny