SceneRandomSource
Defined in: SceneRandomSource.ts:22
Creates the RNG each scene reads through RandomKey, and owns the
seed those RNGs start from. The engine owns one, reachable as
engine.sceneRandom or through SceneRandomSourceKey.
A scene’s RNG starts from the first seed that is set, in this order: the
seed passed to setSeed, the default seed a test harness installs
(DebugPlugin’s deterministicSeed), then a fresh non-deterministic seed.
globalRandom is a separate generator and none of these seeds reach it.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SceneRandomSource(
scenes):SceneRandomSource
Defined in: SceneRandomSource.ts:26
Parameters
Section titled “Parameters”scenes
Section titled “scenes”Returns
Section titled “Returns”SceneRandomSource
Methods
Section titled “Methods”clearSeed()
Section titled “clearSeed()”clearSeed():
void
Defined in: SceneRandomSource.ts:55
Undo setSeed. Scenes on the stack keep their current sequence. Scenes that enter later start from the default seed when a test harness installed one, otherwise from a fresh seed.
Returns
Section titled “Returns”void
createSceneRandom()
Section titled “createSceneRandom()”createSceneRandom():
RandomService
Defined in: SceneRandomSource.ts:32
Create a scene RNG from the current seed policy. The engine calls this as each scene enters and registers the result under RandomKey.
Returns
Section titled “Returns”setDefaultSeed()
Section titled “setDefaultSeed()”setDefaultSeed(
seed):void
Defined in: SceneRandomSource.ts:64
Internal
DebugPlugin installs its deterministicSeed through this
hook and clears it with undefined. A seed set with setSeed
takes precedence.
Parameters
Section titled “Parameters”number | undefined
Returns
Section titled “Returns”void
setSeed()
Section titled “setSeed()”setSeed(
seed):void
Defined in: SceneRandomSource.ts:44
Reseed the RNG of every scene on the stack, and start every scene that
enters later from the same seed. The seed goes through
normalizeSeed, so -1 and 0xffffffff produce the same sequence, as
do 1.9 and 1. Throws for NaN or an infinite seed.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.