[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Makes sort create random order
From: |
Paul Eggert |
Subject: |
Re: [PATCH] Makes sort create random order |
Date: |
Fri, 28 Jan 2005 23:36:41 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Frederik Eaton <address@hidden> writes:
> I think few people would care about this corner case.
Maybe, maybe not; it's a bit hard to tell without knowing why
people need the option to "sort at random".
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.
If not, then I would like to understand the needs better before
writing or reviewing code.
>> > As for the nature of the investigations, well, anything for which
>> > one needs a random permutation, I suppose. Also, random sampling
>> > with sort -R | head, though somewhat inefficient, but convenient,
>>
>> But these uses should not attempt to sort ties together. They should
>> attempt to sort them separately.
>
> Hmm, I don't see any of these uses as involving duplicate elements.
I can. One might need a random sampling of a collection of elements,
some of which are identical to each other.
> If they did, it would become impossible to determine exactly which
> elements were sampled, or exactly what your permutation was.
That's OK in many applications. (You have 30 black balls and 20 white
balls in an urn, and want to select 7 balls without replacement....)
Re: [PATCH] Makes sort create random order, Bob Proulx, 2005/01/28