percentile

Returns the p-th percentile of this list using linear interpolation between closest ranks.

p is a percentage in the range 0.0 to 100.0; percentile(0.0) is the minimum, percentile(100.0) the maximum, and percentile(50.0) the median. The receiver is not modified; sorting happens on a copy in O(n log n).

Throws

if p is not in the range 0.0 to 100.0.

if the list is empty.


@JvmName(name = "percentileOfInt")
fun List<Int>.percentile(p: Double): Double

Returns the p-th percentile of this list using linear interpolation between closest ranks.

Delegates to the List of Double overload after widening each element.

Throws

if p is not in the range 0.0 to 100.0.

if the list is empty.


@JvmName(name = "percentileOfLong")
fun List<Long>.percentile(p: Double): Double

Returns the p-th percentile of this list using linear interpolation between closest ranks.

Delegates to the List of Double overload after widening each element, which loses precision above 2^53.

Throws

if p is not in the range 0.0 to 100.0.

if the list is empty.