I'm new to ruby, but not to programming. I just need a simple script that given a text file will pull out around 10% of the lines at random. Below is what I came up with based upon a python script I wrote. What do I need to do differently to make it more ruby-like? prng = Random.new File.open('english-words-partial.txt', 'w') { |f| File.readlines('english-words-full.txt').each do |line| if prng.rand >= 0.9 f.write(line) end end }