Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of shuf --random-source #2528

Open
miDeb opened this issue Jul 27, 2021 · 1 comment
Open

Implementation of shuf --random-source #2528

miDeb opened this issue Jul 27, 2021 · 1 comment
Labels

Comments

@miDeb
Copy link
Contributor

miDeb commented Jul 27, 2021

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.

@stale
Copy link

stale bot commented Jan 20, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 20, 2023
@tertsdiepraam tertsdiepraam changed the title Implementation of --random-source Implementation of shuf --random-source Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants