bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Makes sort create random order


From: James Youngman
Subject: Re: [PATCH] Makes sort create random order
Date: Sat, 29 Jan 2005 12:07:34 +0000
User-agent: Mutt/1.3.28i

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]