aFile = File.new("a5", "r") f = File.open('a5') a = f.readlines i,x = 0,0 while i < 5 i += 1 x = rand(a.length) puts a[x] a.delete_at(x) end aFile.close