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: Frederik Eaton
Subject: Re: [PATCH] Makes sort create random order
Date: Sun, 30 Jan 2005 12:10:31 -0800
User-agent: Mutt/1.5.6+20040907i

> > A friend introduced me to that trick a few years ago and I have been
> > using it ever since.  $RANDOM is a ksh/bash specific feature.  It is
> > not POSIX but is widely available.
> 
> I think my commentary on this is a bit off-topic here, but your message 
> reminds me of a dream I have for a long time: Having BSD jot implemented 
> in coreutils.  That would overlap some features of seq, so a possibility 
> would be to implement some of the ideas of jot in seq (and I'd really like 
> to contribute with this).
> 
> I'd like to hear opinion of other on this subject.
> 
> For instance, implementing jot's `-r' in seq, we could employ the 
> traditional "$RANDOM" trick this way:
> 
> glacius:~ felipek$ printf "This\nis\nan\nexample\n" > list
> glacius:~ felipek$ jot -r 4 | paste - list | sort | cut -f 2-
> an
> example
> is
> This
> glacius:~ felipek$

Well, this would be much better than the $RANDOM solution - avoiding
shell slowness, etc. Plus, you get two features for one - I'd use the
seq feature for other things as well, I think, provided it was well
implemented - e.g. 'jot' seems to seed it's RNG from epoch seconds,
which is no good, microseconds would be better. The disadvantage is
that it's still more cumbersome to type than it could be, but I guess
it's a simple shell alias for those who use it a lot. In any case, my
opinion is that '-r' would be a good addition to 'seq'.

Frederik




reply via email to

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