Add log normal distributions to the percentile calculation tests

This commit is contained in:
Justin Li
2014-07-22 23:00:12 -04:00
parent 60fd62cc82
commit b6f0fc79cb
2 changed files with 56 additions and 27 deletions

View File

@@ -40,7 +40,7 @@ func (p *Percentile) Value() float64 {
func (p *Percentile) AddSample(sample float64) {
p.samples++
if p.samples > int64(cap(p.values)) {
if len(p.values) == cap(p.values) {
target := float64(p.samples)*p.percentile - float64(cap(p.values))/2
offset := round(math.Max(target, 0))