Skip to main content

method Crypto.getRandomValues

#Crypto.getRandomValues<T extends ArrayBufferView>(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 ArrayBufferView

Parameters #

#array: T

Return Type #

T

The same typed array, now populated with random values.

See #

Did you find what you needed?

Privacy policy