aboutsummaryrefslogtreecommitdiffstats
path: root/prog/heatmap.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-11-25 13:21:34 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-11-25 13:53:49 +0100
commit2dad91ec3dc8e0574b8c8161ab737204c1da1722 (patch)
tree3253e7f535e95d51006dc81836fd7100fc4428ab /prog/heatmap.go
parent0e8f14dcc4db15a509dc2ba4b291e2c28fc51ca0 (diff)
prog: adjust number of image mutations
Also adjust number of mutations per image. We do one per 128K of interesting data. But we have no single seed that has so much interesting data. Here is the amount of interesting data in seeds: https://gist.github.com/dvyukov/566b20364610d80e5d0534524546c3f0 Reduce this cuhnk size to 4K.
Diffstat (limited to 'prog/heatmap.go')
-rw-r--r--prog/heatmap.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/prog/heatmap.go b/prog/heatmap.go
index d1c5ea3b9..2bfbceacc 100644
--- a/prog/heatmap.go
+++ b/prog/heatmap.go
@@ -37,8 +37,17 @@ func MakeGenericHeatmap(data []byte, r *rand.Rand) Heatmap {
}
func (hm *GenericHeatmap) NumMutations() int {
- // At least two mutations, up to about one mutation every 128 KB of heatmap size.
- return hm.r.Intn(hm.length/(1<<17)+1) + 2
+ // At least one mutation.
+ n := 1
+ // + up to about one mutation every 4 KB of heatmap size.
+ n += hm.r.Intn(hm.length/(4<<10) + 1)
+ // + up to 4 mutations at random so that even small images can get more than one.
+ n += hm.r.Intn(5)
+ // But don't do too many as it will most likely corrupt the image.
+ if max := 10; n > max {
+ n = max
+ }
+ return n
}
func (hm *GenericHeatmap) ChooseLocation() int {