Re: random lines
also sprach Joost Kooij (on Mon, 02 Jul 2001 11:15:38PM +0200):
> perl -e 'print map {$_->[1]} sort {$a->[0]<=>$b->[0]} map {[rand,$_]} <>' file
that's perfect!
the other perl algorithm permitted did a scan through the file,
halting on a given line according to a random number. i may well be
wrong here, but doesn't that absolutely favor the entries up to in the
file since they are considered sooooo many more times?
thanks!
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
--
click the start menu and select 'shut down.'
Reply to: