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: Thomas Habets
Subject: Re: [PATCH] Makes sort create random order
Date: Sun, 29 Aug 2004 00:46:43 +0200
User-agent: KMail/1.6.2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Once upon a midnight dreary, Jim Meyering pondered, weak and weary:
>   sort: Add an ordering option -R that causes 'sort' to sort according
>     to a random permutation of the correct sort order.

This means that two different files, that happen to sort to the same output,
should give the same output when randomized with the same SEED. Is that
right? 

I'm not a sorting-expert, but this would mean running through the input twice,
would it not? Once to get the common input, and then another to randomize it.

Is there a good reason for wanting this? It can be emulated by piping it 
through sort before randomizing it. Getting different results can not be 
emulated, however.

>     if you sort a permutation of the same input file
>     with the same --random-seed=SEED option twice, you'll get the same
>     output.

Here however it does not explicitly say what I said above about two different
files.

>     The default SEED is chosen at random, and contains enough
>     information to ensure that the output permutation is random.

So what is "random"? Do we mean "arbitrary" or "unpredictable"?
Also, should "deteministic" here mean that it should now, and forever, and on
all architectures, work the same?

If the latter, and especially if the former, then some thinking will have to
go into it.

But except for writing the PRNG, everything else is trivial. :-)

- ---------
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;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBMQtTKGrpCq1I6FQRAtC0AJ9pt7lwCGrvf3GT/W807/sKVdmHQACgjPdV
Pdx2Mij0TZV3y6vVyFl4LsQ=
=51zO
-----END PGP SIGNATURE-----




reply via email to

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