From 1bb2f73237f8375d364564c4bb2c2ab16a31da87 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 16 May 2023 12:02:52 -0700 Subject: [PATCH] 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 Reviewed-by: Heschi Kreinick Reviewed-by: Cuong Manh Le Reviewed-by: Keith Randall Auto-Submit: Keith Randall Run-TryBot: Keith Randall --- src/hash/maphash/smhasher_test.go | 2 +- 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 27cedc4ce13..a6e8a21e57d 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 099bf511295..65628298251 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)