Skip to content

Commit 5bf15b0

Browse files
[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.
1 parent 7c648e2 commit 5bf15b0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/internal/fuzz/mutator.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ func (m *mutator) mutate(vals []interface{}, maxBytes int) {
8888
case float64:
8989
vals[i] = m.mutateFloat(v, math.MaxFloat64)
9090
case bool:
91-
if m.rand(2) == 1 {
92-
vals[i] = !v // 50% chance of flipping the bool
93-
}
91+
vals[i] = !v
9492
case rune: // int32
9593
vals[i] = rune(m.mutateInt(int64(v), math.MaxInt32))
9694
case byte: // uint8

0 commit comments

Comments
 (0)