in reply to (GOLF) Randomizing lines
perl -e'@l=<>;print while($_=splice@l,rand@l,1)' </CODE>Update:
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.
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 | |
by tadman (Prior) on Jul 27, 2001 at 05:26 UTC |