From 5bf15b09b1b8a83e2e7fec4eb97b3a339348c28a Mon Sep 17 00:00:00 2001 From: Steven Johnstone Date: Thu, 9 Sep 2021 17:46:45 +0100 Subject: [PATCH] [dev.fuzz] internal/fuzz: always perform logical not on booleans when mutating Flip booleans when mutating rather than keeping the same value 50% of the time. Updates #48291. --- src/internal/fuzz/mutator.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/internal/fuzz/mutator.go b/src/internal/fuzz/mutator.go index 9aa56782b0bd05..bab193802a51ef 100644 --- a/src/internal/fuzz/mutator.go +++ b/src/internal/fuzz/mutator.go @@ -88,9 +88,7 @@ func (m *mutator) mutate(vals []interface{}, maxBytes int) { case float64: vals[i] = m.mutateFloat(v, math.MaxFloat64) case bool: - if m.rand(2) == 1 { - vals[i] = !v // 50% chance of flipping the bool - } + vals[i] = !v case rune: // int32 vals[i] = rune(m.mutateInt(int64(v), math.MaxInt32)) case byte: // uint8