From b29b373d912dbf6f6bdc586b08b6973afa3bc910 Mon Sep 17 00:00:00 2001 From: Xinhao Yuan Date: Mon, 22 Jun 2026 07:39:42 -0700 Subject: [PATCH] Always guess position with a chance. This match the function name and the behavior of other engines. PiperOrigin-RevId: 936051384 --- fuzztest/internal/domains/container_mutation_helpers.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fuzztest/internal/domains/container_mutation_helpers.h b/fuzztest/internal/domains/container_mutation_helpers.h index f17d52fa2..530b5239b 100644 --- a/fuzztest/internal/domains/container_mutation_helpers.h +++ b/fuzztest/internal/domains/container_mutation_helpers.h @@ -101,7 +101,8 @@ bool InsertPart(const ContainerT& from, ContainerT& to, inline size_t GetOrGuessPositionHint(std::optional position_hint, size_t max, absl::BitGenRef prng) { - if (position_hint.has_value()) { + if (position_hint.has_value() && *position_hint <= max && + absl::Bernoulli(prng, 0.5)) { return *position_hint; } else { return ChooseOffset(max + 1, prng);