Module: MathArray

Defined in:
lib/sugar-high/array.rb

Instance Method Summary collapse

Instance Method Details

#meanObject



125
126
127
# File 'lib/sugar-high/array.rb', line 125

def mean
 (size > 0) ? sum.to_f / size : 0
end

#sumObject



121
122
123
# File 'lib/sugar-high/array.rb', line 121

def sum
 inject( 0 ) { |sum,x| sum + x }
end