> The way I do this is something like: > > File.open(aFile, 'r') do |f| > tries = 0 > begin > # seek to a random point in the file > f.seek(rand(File.size(aFile))) > > # read to the next tagline ... Interesting. This gives more "weight" to longer lines in the file though, no? In other words, if I had a file of 2 quotes, one being 150k long, the other about 25 characters, I'd rarely get the "short" one, since a random seek would be in the middle of the long quote more often. Not a show-stopper, certainly, and for all but the most contrived, pathological cases (as I just made), this is an interesting solution I hadn't considered. ===== -- Yahoo IM: michael_s_campbell __________________________________________________ Do You Yahoo!? Yahoo! Games - play chess, backgammon, pool and more http://games.yahoo.com/