Provides methods for retrieving pseudorandom values and other utilities using Math.random.

Constructors

Methods

  • Returns a random boolean.

    Returns boolean

    Random boolean.

  • Returns a random floating point number between min (inclusive) and max (exclusive).

    Parameters

    • min: number

      Minimum value

    • max: number

      Maximum value.

    Returns number

    Random float.

  • Returns a random inclusive integer.

    Parameters

    • min: number

      Minimum value.

    • max: number

      Maximum value.

    Returns number

    Random inclusive integer.

  • Shuffles an array using the Fisher-Yates shuffle algorithm. Modifies the input array in place and returns it.

    Type Parameters

    • T

    Parameters

    • arr: T[]

      The array to shuffle.

    Returns T[]

    The shuffled array.