Warning: Do not use this function.
Use gmp_random_bits() or gmp_random_range() instead.
The documentation and the code for this function do NOT match, and in any case this function is quite useless.(PHP 4 >= 4.0.4, PHP 5, PHP 7)
gmp_random — Numero casuale
This function has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0. Relying on this function is highly discouraged.
Genera un numero casuale. Il numero sarà compreso tra 0 e (2 ** n) - 1,
dove n è il numero di bit per limb moltiplicato per limiter.
Se limiter è negativo, vengono generati numeri negativi.
Un limb è un meccanismo interno di GMP. Il numero di bit in un limb non è fisso e può variare da sistema a sistema. In generale, il numero di bit in un limb è 32 oppure 64, ma ciò non è garantito.
Questa funzione non genera valori crittograficamente sicuri, e non dovrebbe essere usata per scopi di crittografia. Se c'è necessità di utilizzare un valore crittograficamente sicuro, si preferisca openssl_random_pseudo_bytes().
limiterIl limitatore.
Può essere o una resource numero GMP, oppure una stringa numerica dal momento che è possibile convertire quest'ultimo in un numero.
Un numero GMP casuale.
Example #1 Esempio di gmp_random()
<?php
$rand1 = gmp_random(1); // numero casuale da 0 a 1 * bit per limb
$rand2 = gmp_random(2); // numero casuale da 0 a 2 * bit per limb
echo gmp_strval($rand1) . "\n";
echo gmp_strval($rand2) . "\n";
?>Il precedente esempio visualizzerà:
1915834968 8642564075890328087
Warning: Do not use this function.
Use gmp_random_bits() or gmp_random_range() instead.
The documentation and the code for this function do NOT match, and in any case this function is quite useless.