clik-engine API
    Preparing search index...

    Function getRandom

    • 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.

      Parameters

      • scene: SceneLike

      Returns SeededRandom | null

      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);
      }
      }