From: Mike Campbell Date: 2002-04-24T23:05:06+09:00 Subject: RE: My First Time > There is also mathematically nice recipe for picking random line from > the file. In Perl at > > http://www.oreilly.com/catalog/cookbook/chapter/ch08.html#chap08_picking_0 > and in Python at > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/59865 > > It is ecological, by not reading entire file into the array of > strings. It is easy to write the same in Ruby. It is a nifty algorithm and works reasonably well, depending on how fast your rand() is. I mention this only as a pedantic nit because it calculates a random number *on every line* of the file, which may or may not be fast enough for you.