-
-
Notifications
You must be signed in to change notification settings - Fork 200
🐛 Jump PRNG in infiniteStream loop before generate #6425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Co-authored-by: dubzzz <[email protected]>
Co-authored-by: dubzzz <[email protected]>
| // possibly leading from totally different sets of functions. | ||
| // In other words: `preBuiltValue !== undefined && context.history.length === 0` is a legit case! | ||
| // If we start to mismatch we run a new random value computation | ||
| localMrng.unsafeJump(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Restrict the jump to the infiniteStream code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! The PRNG jump is now restricted to the infiniteStream loop in StreamArbitrary.ts (line 33). Changes committed in 57fcb44.
Co-authored-by: dubzzz <[email protected]>
Co-authored-by: dubzzz <[email protected]>
The PRNG was not being advanced before generating values in the
infiniteStreamloop, causing inconsistency with thetossmechanism inTosser.ts.Changes
unsafeJump()toRandomclass: Advances internal RNG by 42 values usingunsafeSkipN, matching the jump behavior inTosser.tsunsafeJump()beforegenerate()in infiniteStream: InStreamArbitrary, the PRNG now jumps before eacharb.generate()call in the infinite stream generator loopunsafeJumpmock toRandomHelpersand updated snapshots for infiniteStream tests reflecting the new value sequencesThe jump amount (42) is consistent with existing usage in
QualifiedParameters.tsandTosser.ts. The fix is restricted to the infiniteStream code only, not affecting the general GeneratorArbitrary behavior.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.