> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# randomBytes

```ts theme={null}
function randomBytes(length): Uint8Array
```

Return `length` bytes of cryptographically secure random data.

## Parameters

| Parameter | Type     | Description                      |
| :-------- | :------- | :------------------------------- |
| `length`  | `number` | The number of bytes to generate. |

## Returns

`Uint8Array`

The random bytes.

## Example

```ts theme={null}
randomBytes(8);
```

## Source

[crypto/random.ts:29](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/crypto/random.ts#L29)
