# Random\Randomizer::nextInt

(PHP 8 >= 8.2.0)

Random\Randomizer::nextInt — Get a positive integer

### Descripción

public Random\Randomizer::nextInt(): int

Advertencia

Esta función no está documentada actualmente, solamente se encuentra disponible la lista de parámetros.

### Parámetros

Esta función no tiene parámetros.

### Valores devueltos

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.

### Errores/Excepciones

- To avoid inconsistencies, 32 bit PHP will throw Random\RandomException if the output size of Random\Engine::generate() exceeds 32 bits, as the selected integer cannot be returned losslessly. This affects the native 64 bit engines Random\Engine\PcgOneseq128XslRr64 and Random\Engine\Xoshiro256StarStar. Any userland engine returning more than 4 bytes of randomness is also affected.
- Any Throwables thrown by the Random\Engine::generate() method of the underlying `Random\Randomizer::$engine`.

### Ejemplos

Ejemplo #1 Random\Randomizer::nextInt() example

`<?php
$r = new \Random\Randomizer();
// Random "next" integer:
echo $r->nextInt(), "\n";
?>`

El resultado del ejemplo sería algo similar a:

    8041689838856078718