Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: gmp_random - Manual
[go: Go Back, main page]

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

search for in the

gmp_scan0" width="11" height="7"/> <gmp_prob_prime
Last updated: Mon, 05 Feb 2007

view this page in

gmp_random

(PHP 4 >= 4.0.4, PHP 5)

gmp_random — 乱数

説明

resource gmp_random ( int limiter )

乱数を生成します。乱数の範囲は、ゼロから limiter * limb のビット数 となります。limiter が負の場合、 負の数が生成されます。

limb は GMP の内部機構です。limb のビット数は固定ではなく、 システムによって変化します。一般的には lib は 16 あるいは 32 ビットですが、それが保証されているわけではありません。

例 753. gmp_random() の例

<?php
$rand1
= gmp_random(1); // 0 から 1 * limb のビット数までの間の乱数
$rand2 = gmp_random(2); // 0 から 2 * limb のビット数までの間の乱数

echo gmp_strval($rand1) . "\n";
echo
gmp_strval($rand2) . "\n";
?>

上のプログラムの出力は以下のようになります。


1915834968
8642564075890328087

     



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

gmp_scan0" width="11" height="7"/> <gmp_prob_prime
Last updated: Mon, 05 Feb 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites