estimateQuantile method
Implementation
num? estimateQuantile(double quantile) {
final count = this.count;
if (count == null || count <= 0 || bucketCounts.isEmpty) {
return null;
}
final target = count * quantile;
var running = 0;
for (var index = 0; index < bucketCounts.length; index += 1) {
running += bucketCounts[index];
if (running < target) {
continue;
}
if (index < explicitBounds.length) {
return explicitBounds[index];
}
return explicitBounds.isEmpty ? max : explicitBounds.last;
}
return max;
}