Helps with generating random numbers.

Constructors

Accessors

  • get seed(): number
  • Retrieve the seed of the PRNG.

    Returns number

    The seed of the PRNG.

Methods

  • Returns a pseudo-random value between 1 and 2^32 - 2.

    Returns number

    A pseudo-random value between 1 and 2^32 - 2.

  • Returns either true or false.

    Returns boolean

    Either true or false.

  • Returns a pseudo-random floating point number in range [0, 1).

    Returns number

    a pseudo-random floating point number in range [0, 1).

  • Creates a new Random instance, with a seed that is based of the seed of this Random instance.

    Returns Random

    A new random number generator.

  • Returns a random value in a given range.

    Parameters

    • min: number

      The lower bound.

    • max: number

      The upper bound.

    Returns number

    A random value between the lower and upper bound.

  • Returns a 2D simplex noise value for a given input coordinate.

    Parameters

    • x: number

      The X input coordinate.

    • y: number

      The Y input coordinate.

    Returns number

    The noise value for the input coordinates.

  • Returns a 3D simplex noise value for a given input coordinate.

    Parameters

    • x: number

      The X input coordinate.

    • y: number

      The Y input coordinate.

    • z: number

      The Z input coordinate.

    Returns number

    The noise value for the input coordinates.