(PHP 8 >= 8.2.0)
Random\Randomizer::nextInt — Get a positive integer
public Random\Randomizer::nextInt(): int
This function has no parameters.
A positive integer between 0 and a maximum value depending on the number of bytes returned from Random\Engine::generate(). The exact maximum can be calculated as 2$engine_bytes * 8 - 1 - 1.
Random\Randomizer::$engine. Example #1 Random\Randomizer::nextInt() example
<?php $r = new \Random\Randomizer(); // Random "next" integer: echo $r->nextInt(), "\n"; ?>
The above example will output something similar to:
8041689838856078718
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/random-randomizer.nextint.php