cvs: phpdoc-zh /reference/math/functions mt-getrandmax.xml mt-rand.xml mt-srand.xml

From: Date: Wed, 12 Mar 2003 10:37:01 +0000
Subject: cvs: phpdoc-zh /reference/math/functions mt-getrandmax.xml mt-rand.xml mt-srand.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-1227@lists.php.net to get a copy of this message
dallas Wed Mar 12 05:37:01 2003 EDT Added files: /phpdoc-zh/reference/math/functions mt-getrandmax.xml mt-rand.xml mt-srand.xml Log: Completed. Index: phpdoc-zh/reference/math/functions/mt-getrandmax.xml +++ phpdoc-zh/reference/math/functions/mt-getrandmax.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> <refentry id="function.mt-getrandmax"> <refnamediv> <refname>mt_getrandmax</refname> <refpurpose>ÏÔÊ¾Ëæ»úÊýµÄ×î´ó¿ÉÄÜÖµ</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>int</type><methodname>mt_getrandmax</methodname> <void/> </methodsynopsis> <simpara> ·µ»Øµ÷Óà <function>mt_rand</function> ËùÄÜ·µ»ØµÄ×î´óµÄËæ»úÊý¡£ </simpara> <simpara> ²Î¼û <function>mt_rand</function>£¬<function>mt_srand</function> ºÍ <function>getrandmax</function>¡£ </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/math/functions/mt-rand.xml +++ phpdoc-zh/reference/math/functions/mt-rand.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.mt-rand"> <refnamediv> <refname>mt_rand</refname> <refpurpose>Éú³É¸üºÃµÄËæ»úÊý</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>int</type><methodname>mt_rand</methodname> <methodparam choice="opt"><type>int</type><parameter>min</parameter></methodparam> <methodparam><type>int</type><parameter>max</parameter></methodparam> </methodsynopsis> <simpara> ºÜ¶àÀ쵀 libc µÄËæ»úÊý·¢ÉúÆ÷¾ßÓÐһЩ²»È·¶¨ºÍδ֪µÄÌØÐÔ¶øÇÒºÜÂý¡£PHP µÄ <function>rand</function> º¯ÊýĬÈÏʹÓà libc Ëæ»úÊý·¢ÉúÆ÷¡£<function>mt_rand</function> º¯ÊýÊÇ·ÇÕýʽÓÃÀ´Ìæ»»ËüµÄ¡£¸Ãº¯ÊýÓÃÁË <ulink url="&url.mersenne;">Mersenne Twister</ulink> ÖÐÒÑÖªµÄÌØÐÔ×÷ÎªËæ»úÊý·¢ÉúÆ÷£¬Ëü¿ÉÒÔ²úÉú¿É×÷ΪijЩ¼ÓÃÜËã·¨ÖÖ×ÓµÄËæ»úÊý£¨Ï¸½Ú¼ûÖ÷Ò³£©¶øÇÒ±Èͨ³£ libc ÌṩµÄËÙ¶È¿ìËı¶¡£ </simpara> <simpara> Èç¹ûûÓÐÌṩ¿ÉÑ¡²ÎÊý <parameter>min</parameter> ºÍ <parameter>max</parameter>£¬<function>mt_rand</function> ·µ»Ø 0 µ½ <constant>RAND_MAX</constant> Ö»¼ûµÄÎ±Ëæ»úÊý¡£ÀýÈçÏëÒª 5 µ½ 15£¨°üÀ¨ 5 ºÍ 15£©Ö®¼äµÄËæ»úÊý£¬Óà <literal>mt_rand(5, 15)</literal>¡£ </simpara> <simpara> ÔÚ PHP ½ÏÔç°æ±¾ÖУ¬±ØÐëÔÚʹÓñ¾º¯Êý֮ǰµ÷Óà <function>mt_srand</function> ²¥ÏÂËæ»úÊýÖÖ×Ó¡£×Ô 4.2.0 ²»ÔÙÐèÒªÕâÑù×öÁË¡£ </simpara> <note> <para> ÔÚ 3.0.7 ֮ǰµÄ°æ±¾ÖУ¬<parameter>max</parameter> µÄº¬ÒåÊÇ <parameter>range</parameter>¡£ÒªÔÚÕâЩ°æ±¾Öеõ½ºÍÉÏÀýÏàͬ 5 µ½ 15 µÄËæ»úÊý£¬¼ò¶ÌµÄÀý×ÓÊÇ <literal>mt_rand (5, 11)</literal>¡£ </para> </note> <simpara> ²Î¼û <function>mt_srand</function>£¬<function>mt_getrandmax</function> ºÍ <function>rand</function>¡£ </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/math/functions/mt-srand.xml +++ phpdoc-zh/reference/math/functions/mt-srand.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.mt-srand"> <refnamediv> <refname>mt_srand</refname> <refpurpose>²¥ÏÂÒ»¸ö¸üºÃµÄËæ»úÊý·¢ÉúÆ÷ÖÖ×Ó</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>void</type><methodname>mt_srand</methodname> <methodparam><type>int</type><parameter>seed</parameter></methodparam> </methodsynopsis> <para> Óà <parameter>seed</parameter> À´¸øËæ»úÊý·¢ÉúÆ÷²¥ÖÖ¡£ <informalexample> <programlisting role="php"> <![CDATA[ // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } mt_srand(make_seed()); $randval = mt_rand(); ]]> </programlisting> </informalexample> </para> <note> <para> ×Ô PHP 4.2.0 Æä²»ÔÙÐèÒªÔÚʹÓÃËæ»úÊý·¢ÉúÆ÷֮ǰ¸øÆä²¥ÖÖ¡£ </para> </note> <simpara> ²Î¼û <function>mt_rand</function>£¬<function>mt_getrandmax</function> ºÍ <function>srand</function>¡£ </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->

« previous php.doc.zh (#1227) next »