line = IO.readlines('some_file')
c = rand*line.length.to_i
puts line[c-1]
Very simple logic and it can be easily understood by just looking at the code itself. No explanation needed. If someone knows a better way to do it then please post it in the comments. BTW..thats in ruby.




