PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

gmp_scan0> <gmp_prob_prime
Last updated: Fri, 22 Aug 2008

view this page in

gmp_random

(PHP 4 >= 4.0.4, PHP 5)

gmp_randomGenera un número aleatorio

Descripción

resource gmp_random ( int $limite )

Genera un número aleatorio. El número tendrá un valor entre cero y el producto del "limb" por limite . Si limite es negativo, se generan números negativos.

El "limb" es un mecanismo interno de GMP. El número de bits del "limb" no es constante y suele variar entre 16 y 32 bits.

Example #1 Ejemplo de gmp_random()

<?php
$aleat1 
gmp_random(1); // numero aleatorio entre 0 y ( 1 * bits_de_cada_limb )
$aleat2 gmp_random(2); // numero aleatorio entre 0 y ( 2 * bits_de_cada_limb )

echo gmp_strval($aleat1) . "\n";
echo 
gmp_strval($aleat2) . "\n";
?>

La salida del anterior programa es:

1915834968
8642564075890328087


add a note add a note User Contributed Notes
gmp_random
There are no user contributed notes for this page.

gmp_scan0> <gmp_prob_prime
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites