deno.com

method Crypto.getRandomValues

#Crypto.getRandomValues<T extends
Int8Array
| Int16Array
| Int32Array
| Uint8Array
| Uint16Array
| Uint32Array
| Uint8ClampedArray
| BigInt64Array
| BigUint64Array
>
(array: T): T

Mutates the provided typed array with cryptographically secure random values.

Examples #

#
const array = new Uint32Array(4);
crypto.getRandomValues(array);
console.log(array);
// output: Uint32Array(4) [ 3629234207, 1947236412, 3171234560, 4294901234 ]

Type Parameters #

#T extends
Int8Array
| Int16Array
| Int32Array
| Uint8Array
| Uint16Array
| Uint32Array
| Uint8ClampedArray
| BigInt64Array
| BigUint64Array

Parameters #

#array: T

Return Type #

T

The same typed array, now populated with random values.

See #