On Fri, Jan 28, 2005 at 11:36:41PM -0800, Paul Eggert wrote:
> Let's put it a different way. Suppose we have a program that simply
> generates as output a random permutation of its input lines. Would
> that suffice?
>
> If so, perhaps we should simply create a new "permute" program rather
> than folding its functionality into "sort"; that would fold better
> into the software tools philosophy that "sort" is part of.
I strongly agree.
Such a program could do things interesting like :-
1. Permute pseudo-randomly by default.
2. Permute pseudo-randomly according to a seed specified on the
command line
3. Generate the Nth permutation of its input, according to a
reproducible scheme
4. Permute almost pseudo-randomly but with the proviso that the output
differ from the input - and of course will fail for inputs less
than two lines long.
5. Permute as directed by a stream of 'random' data (e.g. /dev/urandom
or /dev/zero or a saved file - not obvious whether to loop on EOF
or fail.)
These are all interesting ways to permute the lines of a file, but the
number of options implied by the above suggestions would be
inappropriate for "sort".
Regards,
James.