Sha256: ffe304a49da16b5d6e52cf98724f20aabf9fe199fddc1e01023c372b4e02dba3
Contents?: true
Size: 320 Bytes
Versions: 41
Compression:
Stored size: 320 Bytes
Contents
require 'active_support/core_ext/enumerable' module Enumerable def mean sum.to_f / length end def variance m = mean reduce(0) {|accum, item| accum + (item - m) ** 2}.to_f / (length - 1) end def stdev Math.sqrt(variance) end def percentile(pc) sort[(pc * length).ceil - 1] end end
Version data entries
41 entries across 41 versions & 2 rubygems
Version | Path |
---|---|
madvertise-ext-0.9.3 | lib/madvertise/ext/enumerable.rb |