---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# 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

```js
getRandomValues(typedArray)
```

### Parameters

- `typedArray`
  - : An integer-based `TypedArray`, that is one of: `Int8Array`, `Uint8Array`,
    `Uint8ClampedArray`, `Int16Array`, `Uint16Array`,
    `Int32Array`, `Uint32Array`, `BigInt64Array`,
    `BigUint64Array` (but **not** `Float32Array` nor `Float64Array`).
    All elements in the array will be overwritten with random numbers.

### 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 `byteLength` of `typedArray` exceeds 65,536.
