Method: Array#avg

Defined in:
lib/rext/array/helpers.rb

#avgObject Also known as: average

Return the average of numbers within the array.



16
17
18
19
# File 'lib/rext/array/helpers.rb', line 16

def avg
  return 0 if empty?
  sum.to_f / length
end