(counters map[int]uint64)
| 498 | } |
| 499 | |
| 500 | func stdDeviation(counters map[int]uint64) float64 { |
| 501 | sum := uint64(0) |
| 502 | for _, v := range counters { |
| 503 | sum += v |
| 504 | } |
| 505 | mean := float64(sum) / float64(len(counters)) |
| 506 | summedDiffs := 0.0 |
| 507 | for _, v := range counters { |
| 508 | diff := float64(v) - mean |
| 509 | summedDiffs += diff * diff |
| 510 | } |
| 511 | stdDev := math.Sqrt(summedDiffs / float64(len(counters))) |
| 512 | return (stdDev * 100) / mean |
| 513 | } |
| 514 | |
| 515 | func BenchmarkRandomAlgorithm(b *testing.B) { |
| 516 | N := 10 |
no outgoing calls
no test coverage detected
searching dependent graphs…