lib/darkext/statistics.rb
# Finds the mode of the array
Finds the mode of the array
Finds the mode of the array
def mode
    raise ArgumentError.new('Array size must be > 0') if self.size.zero?
    map = self.histogram
    max = map.values.max
    map.keys.select { |x| map[x] == max }
  end
def mode raise ArgumentError . new ( 'Array size must be > 0' ) if self . size . zero? map = self . histogram max = map . values . max map . keys . select { | x | map [ x ] == max } end
Finds the mode of the array
Finds the mode of the array