Math 函数
在线手册:中文 英文
PHP手册

mt_getrandmax

(PHP 4, PHP 5)

mt_getrandmax显示随机数的最大可能值

说明

int mt_getrandmax ( void )

返回调用 mt_rand() 所能返回的最大的随机数。

参见: mt_rand()mt_srand()getrandmax()


Math 函数
在线手册:中文 英文
PHP手册
PHP手册 - N: 显示随机数的最大可能值

用户评论:

z666zz666z at terra dot es (23-Mar-2012 07:22)

Sorry to say this: 2147483647 is not a power of 2.

Maybe you wanted to say it returns 2^31-1, the maximun signed value on 32 bits. 2^31 is 2147483648.

As i said, sorry to say that, it is just a puntualization.

marcus at synchromedia dot co dot uk (10-Aug-2011 09:41)

On both 32 and 64-bit systems (OS X and Linux), mt_getrandmax() returns 2147483647 for me, i.e. ~2^31.