]> Cypherpunks.ru repositories - gostls13.git/commitdiff
hash/maphash: weaken avalanche test a bit
authorKeith Randall <khr@golang.org>
Tue, 16 May 2023 19:02:52 +0000 (12:02 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 17 May 2023 14:45:20 +0000 (14:45 +0000)
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>

src/hash/maphash/smhasher_test.go
src/runtime/hash_test.go

index 27cedc4ce1302fece2cecbd26a0954c7ef9f2f51..a6e8a21e57d4c994e5f12ef0f9ef33b65e657e55 100644 (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)
index 099bf511295ac0352fd92e6a7839a5c335b3dab2..65628298251c5aec282dd58e60e61f0a6b7790ed 100644 (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)