mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-11 00:51:09 -05:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
029299ccf8
commit
6ab45e6de7
1 file changed
+2
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user