lib/dimsum.rb in dimsum-0.0.3 vs lib/dimsum.rb in dimsum-0.0.4
- old
+ new
@@ -15,10 +15,10 @@
def reservoir_stdin(sample_size)
random = Random.new
input_line_number = 0
out = []
- STDIN.readlines.each do |line|
+ STDIN.each_line do |line|
keep, index = keep_line_in_index(input_line_number, sample_size, random)
out[index] = line if keep
input_line_number += 1
end