From a856d133d9a61abe466781788a29ad01d38395c9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 27 Oct 2026 14:01:14 +0000 Subject: [PATCH] script: hash the seed in the brotli fuzzer Seeding SplitMix64 with seed * 0x9E3779B97F4A7C15 made consecutive seeds generate the same sequence shifted by one number, so shards with consecutive seeds repeated each other's cases. --- script/manual-test-brotli-fuzz.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/script/manual-test-brotli-fuzz.c b/script/manual-test-brotli-fuzz.c index 5d4eace9..d63e429d 100644 --- a/script/manual-test-brotli-fuzz.c +++ b/script/manual-test-brotli-fuzz.c @@ -2062,7 +2062,12 @@ main(int argc, char** argv) { } } g_seed = seed; - g_rng_state = seed * 0x9E3779B97F4A7C15ull; + // Hash the seed: SplitMix64 adds 0x9E3779B97F4A7C15 to its state per + // number, so a starting state of (seed * 0x9E3779B97F4A7C15) would make + // seed N+1's sequence that of seed N shifted by one number, and shards with + // consecutive seeds would soon generate the same cases. + g_rng_state = seed; + g_rng_state = r64(); if (!strncmp(argv[1], "-replay=", 8)) { return replay_dec(argv[1] + 8); } else if (!strcmp(argv[1], "-dec")) {