def mean(values)
      raise "values must be an array" unless values.is_a?(Array)

      values.inject(0) {|sum, x| sum + x}.to_f / values.length
    end
def mean(values)
      raise "values must be an array" unless values.is_a?(Array)

      values.inject(0) {|sum, x| sum + x}.to_f / values.length
    end
Expected value
 http://en.wikipedia.org/wiki/mean