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: Bob Proulx
Subject: Re: [PATCH] Makes sort create random order
Date: Sat, 28 Aug 2004 10:53:01 -0600
User-agent: Mutt/1.3.28i

Thomas Habets wrote:
> (if this email goes to a mailinglist then I'm not on it. Please CC
> any replies if that is the case)
> [...]
> So, added -R, --random.

I like the idea of providing a pseudo-randomizing, shuffling
capability.  I have actually wanted that myself on occasion.  Normally
to do this I usually use the nonstandard $RANDOM extension provided by
/bin/ksh and look-alikes such as /bin/bash to shuffle files this way:

  while read line; do echo $RANDOM "$line"; done < DATAFILE \
  | sort -n | sed 's/^[[:digit:]]*[[:space:]]//'

Often I would also like to have a way to repeat that ordering.
Therefore creating a random option begs for the addition of a way to
seed the generator with a value so that the same pseudo random order
can be generated again.

Also, you seed the PRNG with the system time in seconds.  I am not
educated with such matters but I feel certain this will come under
file later as being a poor RN seed.  I would hate to see a simple
feature like this which is not concerned about the strength of the
PRNG be added but then be the cause of a problem in a completely
different application which requires a strong PRNG.

> Note that I use rand() and srand(), if that matters on some OS.

I believe a full implementation will probably need to have autoconf
determine the proper pseudo-random number generator implementation.

Jim Meyering has previously posted guidelines for submissions to the
coreutils.  Attached are two previously statements posted to these
lists concerning this.  In particular I believe your submission is
large enough to warrent a copyright assignment to the FSF.  Do you
have one on file?

Bob

Attachment: submission-guidelines
Description: Text document

Attachment: copyright-assignment-procedure
Description: Text document


reply via email to

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