Phaser API Documentation

  Version: 

Member of: Phaser.Math

<static> Median(values)

Description:

Calculate the median of the given values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.

Parameters:

name type description
values Array.<number>

The values to average.

Returns:
Description:

The median value.

Type:
  • number
Examples:
Since: 3.54.0
Source: src/math/Median.js (Line 7)