cvs: phpdoc /en/reference/array/functions array-rand.xml

From: Date: Fri, 30 May 2003 17:44:31 +0000
Subject: cvs: phpdoc /en/reference/array/functions array-rand.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969354097@lists.php.net to get a copy of this message
philip Fri May 30 13:44:31 2003 EDT Modified files: /phpdoc/en/reference/array/functions array-rand.xml Log: Random seed is automatic as of PHP 4.2.0, and added php tags. Index: phpdoc/en/reference/array/functions/array-rand.xml diff -u phpdoc/en/reference/array/functions/array-rand.xml:1.4 phpdoc/en/reference/array/functions/array-rand.xml:1.5 --- phpdoc/en/reference/array/functions/array-rand.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/array-rand.xml Fri May 30 13:44:31 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.13 --> <refentry id="function.array-rand"> <refnamediv> @@ -28,20 +28,24 @@ of keys for the random entries. This is done so that you can pick random keys as well as values out of the array. </para> - <para> - Don't forget to call <function>srand</function> to seed the random - number generator. - </para> + <note> + <para> + As of PHP 4.2.0, there is no need to seed the random number generator + with <function>srand</function>, as this is now done automatically. + </para> + </note> <para> <example> <title><function>array_rand</function> example</title> <programlisting role="php"> <![CDATA[ +<?php srand ((float) microtime() * 10000000); $input = array ("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $rand_keys = array_rand ($input, 2); print $input[$rand_keys[0]]."\n"; print $input[$rand_keys[1]]."\n"; +?> ]]> </programlisting> </example>

« previous php.doc (#969354097) next »