WireNumberTools::randomInteger()

Return a random integer (cryptographically secure when available)

Available since version 3.0.214.

Usage

// basic usage
$int = $wireNumberTools->randomInteger(int $min, int $max);

// usage with all arguments
$int = $wireNumberTools->randomInteger(int $min, int $max, bool $throw = false);

Arguments

NameType(s)Description
$minint

Minimum value Default:0

$maxint

Maximum value Default:PHP_INT_MAX

$throw (optional)bool

Throw WireException if we cannot achieve a cryptographically secure random number? Default:false

Return value

int


WireNumberTools methods and properties

API reference based on ProcessWire core version 3.0.252