Bug reported by Michael Bode <bob@six.de>.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@18725 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Egon Schmid 2000-01-18 15:13:04 +00:00
parent a09de30038
commit 43320fdba6

View file

@ -530,10 +530,13 @@ $binary = base_convert($hexadecimal, 16, 2);
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>mt_rand</function></funcdef>
<paramdef><parameter><optional>int min</optional></parameter></paramdef>
<paramdef><parameter><optional>int max</optional></parameter></paramdef>
<paramdef>
<parameter><optional>int min</optional></parameter>
</paramdef>
<paramdef>
<parameter><optional>int range</optional></parameter>
</paramdef>
</funcsynopsis>
<simpara>
Many random number generators of older libcs have dubious or
unknown characteristics and are slow. By default, PHP uses the
@ -543,24 +546,29 @@ $binary = base_convert($hexadecimal, 16, 2);
known characteristics, the Mersenne Twister, which will produce
random numbers that should be suitable for cryptographic purposes
and is four times faster than what the average libc provides. The
Homepage of the Mersenne Twister can be found at <ulink url="http://www.math.keio.ac.jp/~matumoto/emt.html">http://www.math.keio.ac.jp/~matumoto/emt.html</ulink>,
and an optimized version of the MT source is available from
<ulink url="http://www.scp.syr.edu/~marc/hawk/twister.html">http://www.scp.syr.edu/~marc/hawk/twister.html</ulink>.</simpara>
Homepage of the Mersenne Twister can be found at <ulink
url="&url.mersenne;">&url.mersenne;</ulink>, and an optimized
version of the MT source is available from <ulink
url="&url.mersenne.twister;">&url.mersenne.twister;</ulink>.
</simpara>
<simpara>
If called without the optional min,max arguments
If called without the optional min, range arguments
<function>mt_rand</function> returns a pseudo-random value
between 0 and RAND_MAX. If you want a random number between 5
and 15 (inclusive), for example, use mt_rand(5,15).</simpara>
between 0 and <constant>RAND_MAX</constant>. If you want a
random number between 5 and 15 (inclusive), for example, use
mt_rand (5, 11).
</simpara>
<simpara>
Remember to seed the random number generator before use with
<function>mt_srand</function>.</simpara>
<function>mt_srand</function>.
</simpara>
<simpara>
See also <function>mt_srand</function>,
<function>mt_getrandmax</function>,
<function>srand</function>,
<function>rand</function> and
<function>getrandmax</function>.</simpara>
<function>getrandmax</function>.
</simpara>
</refsect1>
</refentry>
@ -732,21 +740,25 @@ $randval = mt_rand();
<refentry id="function.rand">
<refnamediv>
<refname>rand</refname>
<refpurpose>generate a random value</refpurpose>
<refpurpose>Generate a random value</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>rand</function></funcdef>
<paramdef><parameter><optional>int min</optional></parameter></paramdef>
<paramdef><parameter><optional>int max</optional></parameter></paramdef>
<paramdef>
<parameter><optional>int min</optional></parameter>
</paramdef>
<paramdef>
<parameter><optional>int range</optional></parameter>
</paramdef>
</funcsynopsis>
<simpara>
If called without the optional min,max arguments rand() returns a
pseudo-random value between 0 and RAND_MAX. If you want a random
number between 5 and 15 (inclusive), for example, use rand(5,15).</simpara>
If called without the optional min,max arguments
<function>rand</function> returns a pseudo-random value between 0
and <constant>RAND_MAX</constant>. If you want a random number
between 5 and 15 (inclusive), for example, use rand(5,11).
</simpara>
<simpara>
Remember to seed the random number generator before use with
<function>srand</function>.</simpara>
@ -755,12 +767,11 @@ $randval = mt_rand();
<function>getrandmax</function>,
<function>mt_rand</function>,
<function>mt_srand</function> and
<function>mt_getrandmax</function>.</simpara>
<function>mt_getrandmax</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.round">
<refnamediv>
<refname>round</refname>
@ -899,7 +910,7 @@ sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../manual.ced"
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil