1
0
mirror of https://github.com/golang/go synced 2024-11-26 17:16:54 -07:00

hash/maphash: weaken avalanche test a bit

Give the test a bit more wiggle room.

Previously the allowed range was about 46.5% to 53.5%. Now it is about 43% TO 57%.

Fixes #60170

Change-Id: Ieda471e0986c52edb9f6d31beb8e41917876d6c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/495415
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
This commit is contained in:
Keith Randall 2023-05-16 12:02:52 -07:00 committed by Gopher Robot
parent c890d40d0d
commit 1bb2f73237
2 changed files with 2 additions and 2 deletions

View File

@ -381,7 +381,7 @@ func avalancheTest1(t *testing.T, k key) {
// find c such that Prob(mean-c*stddev < x < mean+c*stddev)^N > .9999
for c = 0.0; math.Pow(math.Erf(c/math.Sqrt(2)), float64(N)) < .9999; c += .1 {
}
c *= 4.0 // allowed slack - we don't need to be perfectly random
c *= 8.0 // allowed slack - we don't need to be perfectly random
mean := .5 * REP
stddev := .5 * math.Sqrt(REP)
low := int(mean - c*stddev)

View File

@ -513,7 +513,7 @@ func avalancheTest1(t *testing.T, k Key) {
// find c such that Prob(mean-c*stddev < x < mean+c*stddev)^N > .9999
for c = 0.0; math.Pow(math.Erf(c/math.Sqrt(2)), float64(N)) < .9999; c += .1 {
}
c *= 4.0 // allowed slack - we don't need to be perfectly random
c *= 8.0 // allowed slack - we don't need to be perfectly random
mean := .5 * REP
stddev := .5 * math.Sqrt(REP)
low := int(mean - c*stddev)