PokéRogue
    Preparing search index...

    Base class for defining all game helpers.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    Methods

    • Performs the RNG experiment dictated by fn while sampling uniformly n times from the full range of possible RNG values, where n is the number of trials to perform.

      Specifically, this function divides the interval of possible RNG values into n equal slices, then samples exactly once from the midpoint of each interval, and rounds down as necessary for integer-based RNG functions.

      Parameters

      • numTrials: number

        The number of trials to perform

      • fn: () => void | Promise<void>

        The function to be called during each trial

      Returns Promise<void>

      let zeroCounter = 0;

      await game.rng.equalSample(1000, () => {
      if (randSeedInt(1000) === 0) {
      zeroCounter++;
      }
      });

      expect(zeroCounter).toBe(1);