Re: new coreutil? shuffle - randomize file contents
From:
Paul Eggert
Subject:
Re: new coreutil? shuffle - randomize file contents
Date:
Tue, 24 May 2005 09:55:35 -0700
User-agent:
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)
address@hidden writes:
> Logically the only difference from sort is the low level ordering
> algorithm. so I vote for and extra arg to sort:
> --sort="random".
More generally, sort could pretend that every line had an extra field
called "R" whose contents are random. That way, you could use, e.g.:
sort -k 2,2 -k R
which would mean "sort by the 2nd field, but if there are ties then
sort the ties randomly". "sort -R" would be short for "sort -k R".
It's not as easy to implement as it sounds, I'm afraid; even if you
can assume /dev/random or /dev/urandom.