• Returns a random element array with the specified length within the given array

    Type Parameters

    • E

    Parameters

    • Optionalarray: E[]

      the array to random

    • Optionalsize: number

      the size to generate

    Returns E[] | undefined

    a random element array with the specified length within the given array

    randomElements(['1', '2', '3'], 2);