Add per-session seeds and an own deterministic random generator - #7
Merged
Conversation
UseSeed(seed) sets the seed of a factory, CreateSession(recursionLimit, seed) gives one session another seed. Every data source gets its own stream derived from the session seed and the member it feeds (SeedDerivation, FNV-1a over Type.Member), applied once through ISessionSeedable unless the source got an explicit seed. Null evaluators of RespectNullableAnnotations, method argument sources, type factories and the shuffle of Random(count) derive from the seed too. StableRandom (xoshiro256** seeded through SplitMix64, a Random subclass with every member overridden) replaces System.Random in DataSourceBase, DefaultRandomNullEvaluator and CollectionContext, so sequences are defined by this code alone and stay stable across .NET versions; its output is pinned by tests. AutoPocoGlobalSettings removed, AutoPocoDefaults holds the constants. All generated sequences changed once: stable sequence tests regenerated, the shared test helper now prints the actual values as a C# literal on failure. Three tests that only passed by luck of the old stream fixed (null loop limit, time window). README and release notes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
x.UseSeed(seed)per factory (default stays 1337),CreateSession(recursionLimit, seed)per session.Type.Member(SeedDerivation, FNV-1a), applied once viaISessionSeedable; an explicitSetSeedToRandomValuein the configuration lambda wins. Two members with the same source type no longer correlate, nullable value type sources no longer go null together, a member's values do not depend on which other members exist. Null evaluators ofRespectNullableAnnotations, method argument sources, type factories (constructor arguments) and theRandom(count)shuffle follow the seed.StableRandom: xoshiro256** seeded through SplitMix64, aRandomsubclass with every public member overridden, used byDataSourceBase,DefaultRandomNullEvaluatorandCollectionContext. The sequence of a seed is defined by our code, not by the runtime. Output pinned by tests, uniformity and range tests included.AutoPocoGlobalSettingsremoved (mutable process-wide state),AutoPocoDefaultsholds the constantsSeed,NullCreationThreshold,RecursionLimit.NextReturnsStableElementListInTermsOfTestabilitynow appends the actual values as a ready-to-paste C# literal (CSharpLiteral) to the failure message.Nullable*constructors chain through plainintparameters, so "explicit 15" and "default 15" cannot be told apart. Per-source thresholds andRespectNullableAnnotations(threshold)cover it.Test plan
dotnet build -c Releasezero warnings🤖 Generated with Claude Code