Sha256: b043b1cd019114fe811bc079ba471a7c596b054940856d9735f19b1a29efea9e

Contents?: true

Size: 458 Bytes

Versions: 2

Compression:

Stored size: 458 Bytes

Contents

# Array#median

    require 'facets/array/median'

Determines the _sorted_ middle element.

    a = %w{a a b b c c c}
    a.median     #=> "b"

When there are an even number of elements, the greater
of the two middle elements is given.

    a = %w{a a b b c c c d}
    a.median     #=> "c"

An offset can be supplied to get an element relative
to the middle.

    a = %w{a a b b c c c d}
    a.median(-1) #=> "b"

The the array is empty, +nil+ is returned.

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 demo/core/array/median.md
facets-3.1.0 demo/core/array/median.md