• A function which generates random bytes.

    Parameters

    • buffer: Uint8Array

      The Uint8Array to fill with random bytes.

      Notes

      A cryptographically strong random number generator will be used if available. Otherwise, Math.random will be used as a fallback for randomness.

      The following RNGs are supported, listed in order of precedence:

      • window.crypto.getRandomValues
      • window.msCrypto.getRandomValues
      • `require('crypto').randomFillSync
      • `require('crypto').randomBytes
      • Math.random

    Returns void