Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Random

The namespace for random number related functionality.

Index

Variables

Variables

Const getRandomValues

getRandomValues: fallbackRandomValues = (() => {// Look up the crypto module if available.const crypto: any =(typeof window !== 'undefined' && (window.crypto || window.msCrypto)) ||null;// Modern browsers and IE 11if (crypto && typeof crypto.getRandomValues === 'function') {return function getRandomValues(buffer: Uint8Array): void {return crypto.getRandomValues(buffer);};}// Fallbackreturn fallbackRandomValues;})()

A function which generates random bytes. A function which generates random bytes.

param

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
param

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

Generated using TypeDoc