diff options
author | Keith Randall <khr@golang.org> | 2023-05-16 12:02:52 -0700 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-05-17 14:45:20 +0000 |
commit | 1bb2f73237f8375d364564c4bb2c2ab16a31da87 (patch) | |
tree | 965f22f861eccdcb04e2e8d122c55899635aaec5 | |
parent | c890d40d0db00a6a91fd48acee024f0478f10ce4 (diff) | |
download | go-git-1bb2f73237f8375d364564c4bb2c2ab16a31da87.tar.gz |
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>
-rw-r--r-- | src/hash/maphash/smhasher_test.go | 2 | ||||
-rw-r--r-- | src/runtime/hash_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/hash/maphash/smhasher_test.go b/src/hash/maphash/smhasher_test.go index 27cedc4ce1..a6e8a21e57 100644 --- a/src/hash/maphash/smhasher_test.go +++ b/src/hash/maphash/smhasher_test.go @@ -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) diff --git a/src/runtime/hash_test.go b/src/runtime/hash_test.go index 099bf51129..6562829825 100644 --- a/src/runtime/hash_test.go +++ b/src/runtime/hash_test.go @@ -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) |