Class Distribution (2.17.0)

publicclassDistribution

Distribution records values from0 (inclusive) toendValue (exclusive) and computes their percentiles.

Methods may be called concurrently.

Constructors

Distribution(int endValue)

publicDistribution(intendValue)
Parameter
NameDescription
endValueint

Methods

getNthPercentile(double percentile)

publiclonggetNthPercentile(doublepercentile)
Parameter
NameDescription
percentiledouble
Returns
TypeDescription
long

getPercentile(double percentile)

publicintgetPercentile(doublepercentile)

Get the percentile of recorded values. If called concurrently with#record(int), the result is an approximate.

Parameter
NameDescription
percentiledouble
Returns
TypeDescription
int

record(int value)

publicvoidrecord(intvalue)

Records a new value.

The value must not be negative. To help with distributions with long tails, if the given value is greater than or equal toendValue, the valueendValue-1 is recorded instead.

Parameter
NameDescription
valueint

toString()

publicStringtoString()
Returns
TypeDescription
String
Overrides

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.