in reply to (GOLF) Randomizing lines

Err, 48 if you count the whole works:
perl -e'@l=<>;print while($_=splice@l,rand@l,1)' </CODE>
Update:
Best beat myself before someone else does. As often occurs, map inspires and produces useful results. 46 characters:
perl -e'map{splice@l,rand@l+1,0,$_}<>;print@l'
Or, if you really want to get down to brass tacks, 45 characters:
perl -e'splice@l,rand@l+1,0,$_ for<>;print@l'
Note that the '+1' can be eliminated if there is a blank line at the start of the file.

Update 2.0
It occured to me to break sort and make it act all screwy, which sure jumbles up the text a fair bit, for all intents appearing totally random. 31 characters:
perl -e'print sort{4-rand 9}<>'

Replies are listed 'Best First'.
Re (tilly) 2: (GOLF) Randomizing lines
by tilly (Archbishop) on Jul 26, 2001 at 21:13 UTC
    Version 2, aside from the obvious defect of needing to be adjusted to your file, is rather dangerous. It can dump core on older Perls, and will be biased even on recent ones. (I think you knew that, but I though it worth pointing out.)
      I'm not sure what you mean by "adjusted to your file", as it seems to work quite well on any given data. It isn't perfectly random, as things aren't shuffled quite as much as the splice approach, but they are shuffled to the point of being random-looking with no obvious patterns. Since we're not picking winning lottery numbers, I thought that would be acceptable.

      I can only presume that since the output of the comparator used by sort does return different values for the same $a-$b pair, this could really bust a gasket on some of the older Perls which perhaps assume that this would not occur. IMHO, this is a bug in Perl more than it is a bug in the program, as no program is supposed to be able to dump core, unless, perhaps, it uses the dump command.