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

# util.randomBytes()

> Public low-code contract, signatures and examples for util.randomBytes.

## `util.randomBytes()`

Synchronously generates random bytes as a string. Size: integer 0..65536 bytes before encoding.

Invalid types/options throw TypeError; size/range throws RangeError.

### Signature

```ts theme={null}
static randomBytes(size?: number, encoding?: 'hex' | 'base64'): string;
```

### Example

```ts theme={null}
const bytes = util.randomBytes(16, 'hex');
```

See [all util methods](https://docs.revoengine.com/low-code/reference/util.md) or [runtime basics](https://docs.revoengine.com/low-code/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.