UNPKG

816 BTypeScriptView Raw
1import { fallbackRandomValues } from './random';
2/**
3 * The namespace for random number related functionality.
4 */
5export declare namespace Random {
6 /**
7 * A function which generates random bytes.
8 *
9 * @param buffer - The `Uint8Array` to fill with random bytes.
10 *
11 * #### Notes
12 * A cryptographically strong random number generator will be used if
13 * available. Otherwise, `Math.random` will be used as a fallback for
14 * randomness.
15 *
16 * The following RNGs are supported, listed in order of precedence:
17 * - `window.crypto.getRandomValues`
18 * - `window.msCrypto.getRandomValues`
19 * - `require('crypto').randomFillSync
20 * - `require('crypto').randomBytes
21 * - `Math.random`
22 */
23 const getRandomValues: typeof fallbackRandomValues;
24}