From: gabriele renzi Date: 2004-07-24T20:36:55+09:00 Subject: Re: The number of lines of a file? il Sat, 24 Jul 2004 20:07:31 +0900, Gavin Sinclair ha scritto:: >I think you want > > lines = File.readlines('w.txt') > random_line = lines[rand(lines.size)] > >rand(n) returns an integer in the range 0...n, which is good for an >array index. > oops about rand(). OTOH I was pointing out the 'line is a user defined concept' thingy by not using readlines.