Description
I was recently trying to migrate all of our rand
dependencies to a single version. I noticed that ReadRng
, which we use to implement --random-source
in shuf
, was deprecated in the newest version of rand
. Naturally, I opened an issue in rand
to complain: rust-random/rand#1152. There I learned that implementing --random-source
is not a very good idea, and that the suggestions in gnu's manual about it are outdated. The only remaining valuable usage of --random-source
seems to be to provide reproducibility (two runs involving randomness produce the same result). The suggestion I got was not to implement --random-source
, but to add a different flag like --random-seed
that takes a string to seed the random number generator.
Introducing a new flag seems like the better option because we'd change the behavior: While --random-source
reads all the random bytes from the provided file, --random-seed
would only take a string to seed the rng. All random bytes would then be generated by the rng (which is faster than reading from a file).
Before starting to implement this I wanted to see if anybody has opinions on this. This proposal would mean that we'd replace a flag that is present in both gnu and freebsd with our own thing. This flag is used for the sort
, shuf
and shred
commands.