random.values

Generates random values. The same function as the standard crypto.getRandomValues.

Note

The result is generated using the cryptographically secure random number generator.

Syntax

values(typedArray)

Parameters

Return value

The same typed array as the parameter, filled with random values.

Example

random.values(new Uint8Array(8))
Uint8Array [181, 221, 110, 124, 191, 102, 40, 246]
random.values(new BigInt64Array(2))
BigInt64Array [1364260839042713042, -2173253636153072395]
random.values(new Float64Array(8))
TypeError: not an integer array

See also