Read the per-instance harness RNG from inside a scene. Returns null when the scene is not running under the test harness, so scenes can fall back to Math.random() in production without runtime checks.
null
Math.random()
import { BaseScene, getRandom } from 'clik-engine';class DungeonScene extends BaseScene { create() { super.create(); const rng = getRandom(this); const rooms = rng ? rng.nextInt(4, 12) : randomInt(4, 12); }} Copy
import { BaseScene, getRandom } from 'clik-engine';class DungeonScene extends BaseScene { create() { super.create(); const rng = getRandom(this); const rooms = rng ? rng.nextInt(4, 12) : randomInt(4, 12); }}
Read the per-instance harness RNG from inside a scene. Returns
nullwhen the scene is not running under the test harness, so scenes can fall back toMath.random()in production without runtime checks.