[prev in list] [next in list] [prev in thread] [next in thread]
List: coreutils
Subject: Re: sort/shuf/shred: support fixed random-seed
From: Bernhard Voelker <mail () bernhard-voelker ! de>
Date: 2015-02-10 7:44:37
Message-ID: 54D9B6E5.9000703 () bernhard-voelker ! de
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic