Function randomCrypto

  • Get a random value of an Array with crypto

    Type Parameters

    • Arr extends any[]

    Parameters

    Returns Arr[number] | undefined

    Example

    import { array } from "@rjweb/utils"

    const arr = ['A', 'B', 'C', 'D', 'E']

    array.randomCrypto(arr, 2) // 'C'
    array.randomCrypto(arr, 4) // 'A'

    Since

    1.12.12

    Supports

    nodejs, browser