getRandomValues
Start from API_LEVEL
5.0. Please refer to API_LEVEL.
Fills the supplied Uint8Array with hardware-generated random values and returns the same array object. Throws an exception on failure.
Type
function getRandomValues(array: InputArray): Result
Parameters
InputArray
| Type | Description |
|---|---|
Uint8Array | The Uint8Array to fill with hardware-generated random values |
Result
| Type | Description |
|---|---|
Uint8Array | The original array filled with random values |
Example
import { getRandomValues } from '@zos/crypto'
const bytes = new Uint8Array(16)
getRandomValues(bytes)
console.log(bytes)