Skip to content

docs: Fix incorrect Math.random() note in reducer context#4667

Open
clockwork-labs-bot wants to merge 1 commit intomasterfrom
bot/fix-ts-random-docs
Open

docs: Fix incorrect Math.random() note in reducer context#4667
clockwork-labs-bot wants to merge 1 commit intomasterfrom
bot/fix-ts-random-docs

Conversation

@clockwork-labs-bot
Copy link
Collaborator

Per Joshua: the note about Math.random() in the reducer context docs is out of date and incorrect. TypeScript modules should use ctx.random instead.

Changes:

  • Remove Math.random() from the warning about non-deterministic RNGs (it was listed alongside C#'s Random as something to avoid)
  • Replace the incorrect :::note block with a proper table row documenting ctx.random in the TypeScript context properties reference
  • Same fixes applied to versioned docs (v1.12.0)

TypeScript modules use ctx.random (a deterministic RNG on the context),
not Math.random(). The old note incorrectly stated that Math.random()
was automatically seeded by SpacetimeDB.

Changes:
- Remove Math.random() from the warning about non-deterministic RNGs
- Replace the incorrect note with a proper table row documenting
  ctx.random in the TypeScript context properties reference
- Apply same fixes to versioned docs (v1.12.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants