Crypto.getRandomValues()
The Crypto.getRandomValues() method lets you get cryptographically strong random values.
The array given as the parameter is filled with random numbers (random in its cryptographic meaning).
Syntax
getRandomValues(typedArray)
Parameters
typedArray- : An integer-based
TypedArray, that is one of:Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,BigInt64Array,BigUint64Array(but notFloat32ArraynorFloat64Array). All elements in the array will be overwritten with random numbers.
- : An integer-based
Return value
The same array passed as typedArray but with its contents replaced with the newly generated random numbers.
Note that typedArray is modified in-place, and no copy is made.
Exceptions
QuotaExceededError- : Thrown if the
byteLengthoftypedArrayexceeds 65,536.
- : Thrown if the