Sha256: 9f19dfe506d7ecbb7a5edc3f16829c7d9a59c22769408f91aade34c06c577eb8
Contents?: true
Size: 306 Bytes
Versions: 25
Compression:
Stored size: 306 Bytes
Contents
module Enumerable def sum reduce(:+) end 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
25 entries across 25 versions & 1 rubygems