-
Notifications
You must be signed in to change notification settings - Fork 3
Implement TC39 SeededPRNG #1022
Copy link
Copy link
Open
Labels
engineTGocciaEngine: language semantics, ECMAScript built-ins, parser, interpreter, bytecode VMTGocciaEngine: language semantics, ECMAScript built-ins, parser, interpreter, bytecode VMnew featureNew feature or requestNew feature or requestspec complianceMismatch against official JavaScript/TypeScript specificationMismatch against official JavaScript/TypeScript specification
Milestone
Description
Metadata
Metadata
Assignees
Labels
engineTGocciaEngine: language semantics, ECMAScript built-ins, parser, interpreter, bytecode VMTGocciaEngine: language semantics, ECMAScript built-ins, parser, interpreter, bytecode VMnew featureNew feature or requestNew feature or requestspec complianceMismatch against official JavaScript/TypeScript specificationMismatch against official JavaScript/TypeScript specification
Summary
Implement the Stage 2 TC39 proposal: https://github.com/tc39/proposal-seeded-random
Implement current Random and Random.Seeded APIs using proposal-specified ChaCha12, byte seed/state formats, random, seed, and save/restore semantics.
Why
This proposal fits GocciaScript's modern ECMAScript surface and the 0.13.0 proposal roadmap. It should extend the engine's existing architecture rather than arrive as a userland shim.
Current behavior
The host has private SplitMix64 deterministic randomness, but JavaScript has no Random namespace or reproducible generator objects.
Expected behavior
Implement current Random and Random.Seeded APIs using proposal-specified ChaCha12, byte seed/state formats, random, seed, and save/restore semantics.
Scope notes
Do not expose SplitMix64 as the proposal algorithm. Keep host and script PRNGs separate, copy caller buffers, version/test persisted state, and verify identical vectors across platforms/realms. Additive API: no flag.
Related bytecode roadmap: #871 and #875. Update relevant documentation and the Goccia proposal inventory. Use the current proposal specification at implementation time; add focused project tests and matching pinned Test262/proposal coverage without regressions.
Acceptance criteria