WireRandom::integer()

Get a random integer

Usage

// basic usage
$int = $wireRandom->integer();

// usage with all arguments
$int = $wireRandom->integer(int $min = 0, int $max = 9223372036854775807, array $options = []);

Arguments

NameType(s)Description
$min (optional)int

Minimum allowed value Default:0

$max (optional)int

Maximum allowed value Default:PHP_INT_MAX

$options (optional)array
  • info (bool): Return array of [value, type] indicating what type of random generator was used? Default:false
  • cryptoSecure (bool): Throw WireException if cryptographically secure type not available Default:false

Return value

int array

Returns integer, or will return array if $info option specified.

Exceptions

Method can throw exceptions on error:

  • WireException


WireRandom methods and properties

API reference based on ProcessWire core version 3.0.253