Function element

  • Generate a random element from an array.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array from which to select a random element.

    Returns T

    A random element from the array.

    Example

    const colors = ['red', 'blue', 'green', 'yellow'];
    const randomColor = RNG.element(colors);
    console.log(randomColor); // Output: e.g., "blue"

Generated using TypeDoc