lib/darkext/statistics.rb
# Finds the median of the array
Finds the median of the array
Finds the median of the array
def median
    raise ArgumentError.new('Array size must be > 0') if self.size.zero?
    case self.size % 2
    when 0
      return self.sort[(self.size / 2) - 1, 2].mean
    when 1
      return self.sort[self.size / 2]
    end
  end
def median raise ArgumentError . new ( 'Array size must be > 0' ) if self . size . zero? case self . size % 2 when 0 return self . sort [ ( self . size / 2 ) - 1 , 2 ] . mean when 1 return self . sort [ self . size / 2 ] end end
Finds the median of the array
Finds the median of the array