Repository navigation
Fix seeding collisions in the TypeScript module RNG - #6323
Open
bradleyshep wants to merge 1 commit into
Open
bradleyshep wants to merge 1 commit into
bradleyshep wants to merge 1 commit into
Conversation
bradleyshep
marked this pull request as ready for review
October 16, 2026 19:37
This branch has not been deployed
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.
Description of Changes
pcg32rotates with>>>instead of>>.rand'sseed_from_u64does.Each reducer and procedure transaction seeds its RNG from its timestamp. The signed shift and the 32-bit seed made different timestamps share the same stream. Across 1,000,000 consecutive microsecond timestamps, 243,733 produced the same first 16 bytes as an earlier timestamp.
ctx.newUuidV4()could return duplicate UUIDs, which surfaced asValue with given unique identifier already exists. With this change: 0.API and ABI breaking changes
None. The API is unchanged. A given timestamp now produces different random values than before. Transactions with the same timestamp still share values, as in the Rust bindings.
Rollback safety impact
n/a
Expected complexity level and risk
1
Testing
pnpm exec vitest run tests/rng.test.tsbindings-typescriptlint, type build and unit tests (38 files, 477 tests)