mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Document gmp_random_seed() function
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@337506 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
784c7b502d
commit
dd3d8ba784
2 changed files with 120 additions and 0 deletions
119
reference/gmp/functions/gmp-random-seed.xml
Normal file
119
reference/gmp/functions/gmp-random-seed.xml
Normal file
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 333674 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.gmp-random-seed">
|
||||
<refnamediv>
|
||||
<refname>gmp_random_seed</refname>
|
||||
<refpurpose>Sets the RNG seed</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>gmp_random_seed</methodname>
|
||||
<methodparam><type>mixed</type><parameter>seed</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>seed</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The seed to be set for the <function>gmp_random</function>,
|
||||
<function>gmp_random_bits</function>, and
|
||||
<function>gmp_random_range</function> functions.
|
||||
</para>
|
||||
|
||||
&gmp.parameter;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &null; on success.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors"><!-- {{{ -->
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
Issues an <constant>E_WARNING</constant> and returns &false; if
|
||||
<parameter>seed</parameter> is not valid.
|
||||
</para>
|
||||
</refsect1><!-- }}} -->
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>gmp_random_seed</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// set the seed
|
||||
gmp_random_seed(100);
|
||||
|
||||
var_dump(gmp_strval(gmp_random(1)));
|
||||
|
||||
// set the seed to something else
|
||||
gmp_random_seed(gmp_init(-100));
|
||||
|
||||
var_dump(gmp_strval(gmp_random_bits(10)));
|
||||
|
||||
// set the seed to something invalid
|
||||
var_dump(gmp_random_seed('not a number'));
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
string(20) "15370156633245019617"
|
||||
string(3) "683"
|
||||
|
||||
Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d
|
||||
bool(false)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<simplelist>
|
||||
<member><function>gmp_init</function></member>
|
||||
<member><function>gmp_random</function></member>
|
||||
<member><function>gmp_random_bits</function></member>
|
||||
<member><function>gmp_random_range</function></member>
|
||||
</simplelist>
|
||||
</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:"~/.phpdoc/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
|
||||
-->
|
|
@ -40,6 +40,7 @@
|
|||
<function name='gmp_random' from='PHP 4 >= 4.0.4, PHP 5'/>
|
||||
<function name='gmp_random_bits' from='PHP 5 >= 5.6.3'/>
|
||||
<function name='gmp_random_range' from='PHP 5 >= 5.6.3'/>
|
||||
<function name='gmp_random_seed' from='PHP 7'/>
|
||||
<function name='gmp_root' from='PHP 5 >= 5.6.0'/>
|
||||
<function name='gmp_rootrem' from='PHP 5 >= 5.6.0'/>
|
||||
<function name='gmp_scan0' from='PHP 4 >= 4.0.4, PHP 5'/>
|
||||
|
|
Loading…
Reference in a new issue