UNPKG

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