From 6ab45e6de74c6a49da8caa4629f998404a2aedbb Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Fri, 25 Sep 2026 08:12:07 -0400 Subject: [PATCH] test(engine): seed spacing brute-force sampling deterministically The seed came from string.GetHashCode, which .NET randomizes per process, so each run drew different samples and the "ring" case occasionally drew fewer than six rejections and failed its coverage assertion (1 in 6 runs), even though every validator decision matched the brute-force reference. Co-Authored-By: Claude Opus 5.5 --- OpenNest.Engine.Tests/Jobs/NestJobSpacingValidationTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenNest.Engine.Tests/Jobs/NestJobSpacingValidationTests.cs b/OpenNest.Engine.Tests/Jobs/NestJobSpacingValidationTests.cs index 523a09e..4b0c118 100644 --- a/OpenNest.Engine.Tests/Jobs/NestJobSpacingValidationTests.cs +++ b/OpenNest.Engine.Tests/Jobs/NestJobSpacingValidationTests.cs @@ -37,7 +37,8 @@ public class NestJobSpacingValidationTests ); var bounds = program.BoundingBox(); - var random = new Random(name.GetHashCode(StringComparison.Ordinal) & 0x7fff); + // string.GetHashCode is randomized per process; a stable seed keeps the sampling reproducible. + var random = new Random(name.Aggregate(17, (hash, c) => unchecked(hash * 31 + c)) & 0x7fff); var accepted = 0; var rejected = 0;