Skip to content

RandomBytesGenerator

RandomBytesGenerator generates strings of random binary data using the built-in random_bytes() PHP function

See Also:

  • http://php.net/random_bytes - random_bytes()

Methods

generate

Generates a string of randomized binary data

public generate(int $length): string

Parameters:

Parameter Type Description
$length int The number of bytes of random binary data to generate

Return Value:

A binary string

Throws:

if random_bytes() throws an exception/error



Automatically generated on 2025-03-18