svn: /phpdoc/en/trunk/reference/math/functions/ mt-rand.xml rand.xml

From: Date: Wed, 24 Feb 2016 21:58:20 +0000
Subject: svn: /phpdoc/en/trunk/reference/math/functions/ mt-rand.xml rand.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-14038@lists.php.net to get a copy of this message
yohgaki Wed, 24 Feb 2016 21:58:20 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=338662 Log: Add warnings to rand()/mt_rand(). Changed paths: U phpdoc/en/trunk/reference/math/functions/mt-rand.xml U phpdoc/en/trunk/reference/math/functions/rand.xml Modified: phpdoc/en/trunk/reference/math/functions/mt-rand.xml =================================================================== --- phpdoc/en/trunk/reference/math/functions/mt-rand.xml 2016-02-24 15:15:21 UTC (rev 338661) +++ phpdoc/en/trunk/reference/math/functions/mt-rand.xml 2016-02-24 21:58:20 UTC (rev 338662) @@ -119,16 +119,15 @@ </refsect1> <refsect1 role="notes"> &reftitle.notes; - <caution> + <warning> <para> - The distribution of <function>mt_rand</function> return values is biased - towards even numbers on 64-bit builds of PHP when - <parameter>max</parameter> is beyond <literal>2^32</literal>. - This is because if <parameter>max</parameter> is greater than - the value returned by <function>mt_getrandmax</function>, the output of the - random number generator must be scaled up. + <parameter>min</parameter> <parameter>max</parameter> range must + be within the range <function>mt_getrandmax</function>. i.e. (<parameter>max</parameter> - + <parameter>min</parameter>) &lt;= <function>mt_getrandmax</function> + Otherwise, <function>mt_rand</function> may return poor random numbers + than it should be. </para> - </caution> + </warning> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; Modified: phpdoc/en/trunk/reference/math/functions/rand.xml =================================================================== --- phpdoc/en/trunk/reference/math/functions/rand.xml 2016-02-24 15:15:21 UTC (rev 338661) +++ phpdoc/en/trunk/reference/math/functions/rand.xml 2016-02-24 21:58:20 UTC (rev 338662) @@ -91,6 +91,20 @@ </example> </para> </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <warning> + <para> + <parameter>min</parameter> <parameter>max</parameter> range must + be within the range <function>getrandmax</function>. i.e. (<parameter>max</parameter> - + <parameter>min</parameter>) &lt;= <function>getrandmax</function> + Otherwise, <function>rand</function> may return poor random numbers + than it should be. + </para> + </warning> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para>

« previous php.doc.cvs (#14038) next »