Sha256: 15037975efd9f1d737db1b049f18173c27f2f5cc9cab2ff906f0e00a296c0fe2
Contents?: true
Size: 292 Bytes
Versions: 10
Compression:
Stored size: 292 Bytes
Contents
module Enumerable # In Statistics mode is the value that occurs most # frequently in a given set of data. # # CREDIT: Robert Klemme def mode max = 0 c = Hash.new 0 each {|x| cc = c[x] += 1; max = cc if cc > max} c.select {|k,v| v == max}.map {|k,v| k} end end
Version data entries
10 entries across 10 versions & 1 rubygems