php-doc-en/reference/math/functions/srand.xml
Mehdi Achour e62b27dd06 Added title to examples
wrapped the see also lines (make it easy to translate)


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@153341 c90b9560-bf6c-de11-be94-00142212c4b1
2004-03-10 14:39:13 +00:00

70 lines
1.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/math.xml, last change in rev 1.2 -->
<refentry id="function.srand">
<refnamediv>
<refname>srand</refname>
<refpurpose>Seed the random number generator</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>void</type><methodname>srand</methodname>
<methodparam choice="opt"><type>int</type><parameter>seed</parameter></methodparam>
</methodsynopsis>
<para>
Seeds the random number generator with <parameter>seed</parameter>.
Since PHP 4.2.0, the <parameter>seed</parameter>
becomes optional and defaults to a random value if omitted.
</para>
<para>
<example>
<title><function>srand</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// seed with microseconds
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$randval = rand();
?>
]]>
</programlisting>
</example>
</para>
&note.randomseed;
<simpara>
See also:
<function>rand</function>,
<function>getrandmax</function>, and
<function>mt_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
-->