<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.gmp-random-range" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>gmp_random_range</refname>
  <refpurpose>Random number</refpurpose>
 </refnamediv>
 
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>GMP</type><methodname>gmp_random_range</methodname>
   <methodparam><type class="union"><type>GMP</type><type>int</type><type>string</type></type><parameter>min</parameter></methodparam>
   <methodparam><type class="union"><type>GMP</type><type>int</type><type>string</type></type><parameter>max</parameter></methodparam>
  </methodsynopsis>
  <para>
   Generate a random number. The number will be between
   <parameter>min</parameter> and <parameter>max</parameter>.
  </para>
  <para>
   <parameter>min</parameter> and <parameter>max</parameter> can both be negative but <parameter>min</parameter> must always be less than <parameter>max</parameter>.
  </para>
  &caution.cryptographically-insecure;
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>min</parameter></term>
     <listitem>
      <para>
       A GMP number representing the lower bound for the random number
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>max</parameter></term>
     <listitem>
      <para>
       A GMP number representing the upper bound for the random number
      </para>
     </listitem>
    </varlistentry>   
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   A random GMP number.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>gmp_random_range</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
$rand1 = gmp_random_range(0, 100);    // random number between 0 and 100
$rand2 = gmp_random_range(-100, -10); // random number between -100 and -10

echo gmp_strval($rand1) . "\n";
echo gmp_strval($rand2) . "\n";
?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
42
-67
]]>
    </screen>
   </example>
  </para>
 </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
-->
