Skip to content

Bytes.random

Generates random Bytes.Bytes of the specified length.

Imports

Named
import { Bytes } from 'ox'

Examples

import { Bytes } from 'ox'
 
const bytes = Bytes.random(32)
Uint8Array([... x32])

Definition

function random(
  length: number,
): Bytes

Source: src/Bytes.ts

Parameters

length

  • Type: number

Length of the random Bytes.Bytes to generate.

Return Type

Random Bytes.Bytes of the specified length.

Bytes