reference/math/functions/rand.xml
2166824858a40ea664c558f2930b63b8f4fd89c6
...
...
@@ -1,142 +0,0 @@
1
-
<?xml version="1.0" encoding="utf-8"?>
2
-
<!-- $Revision$ -->
3
-
<refentry xml:id="function.rand" xmlns="http://docbook.org/ns/docbook">
4
-
<refnamediv>
5
-
<refname>rand</refname>
6
-
<refpurpose>Generate a random integer</refpurpose>
7
-
</refnamediv>
8
-
<refsect1 role="description">
9
-
&reftitle.description;
10
-
<methodsynopsis>
11
-
<type>int</type><methodname>rand</methodname>
12
-
<void/>
13
-
</methodsynopsis>
14
-
<methodsynopsis>
15
-
<type>int</type><methodname>rand</methodname>
16
-
<methodparam><type>int</type><parameter>min</parameter></methodparam>
17
-
<methodparam><type>int</type><parameter>max</parameter></methodparam>
18
-
</methodsynopsis>
19
-
<simpara>
20
-
If called without the optional <parameter>min</parameter>,
21
-
<parameter>max</parameter> arguments <function>rand</function>
22
-
returns a pseudo-random integer between 0 and
23
-
<function>getrandmax</function>. If you want a random number
24
-
between 5 and 15 (inclusive), for example, use <literal>rand(5,
25
-
15)</literal>.
26
-
</simpara>
27
-
<note>
28
-
<simpara>
29
-
On some platforms (such as Windows), <function>getrandmax</function>
30
-
is only 32767. If you require a range larger than 32767, specifying
31
-
<parameter>min</parameter> and <parameter>max</parameter> will allow
32
-
you to create a range larger than this, or consider using
33
-
<function>mt_rand</function> instead.
34
-
</simpara>
35
-
</note>
36
-
</refsect1>
37
-
<refsect1 role="parameters">
38
-
&reftitle.parameters;
39
-
<para>
40
-
<variablelist>
41
-
<varlistentry>
42
-
<term><parameter>min</parameter></term>
43
-
<listitem>
44
-
<para>
45
-
The lowest value to return (default: 0)
46
-
</para>
47
-
</listitem>
48
-
</varlistentry>
49
-
<varlistentry>
50
-
<term><parameter>max</parameter></term>
51
-
<listitem>
52
-
<para>
53
-
The highest value to return (default: <function>getrandmax</function>)
54
-
</para>
55
-
</listitem>
56
-
</varlistentry>
57
-
</variablelist>
58
-
</para>
59
-
</refsect1>
60
-
<refsect1 role="returnvalues">
61
-
&reftitle.returnvalues;
62
-
<para>
63
-
A pseudo random value between <parameter>min</parameter>
64
-
(or 0) and <parameter>max</parameter> (or <function>getrandmax</function>, inclusive).
65
-
</para>
66
-
</refsect1>
67
-
<refsect1 role="changelog">
68
-
&reftitle.changelog;
69
-
<para>
70
-
<informaltable>
71
-
<tgroup cols="2">
72
-
<thead>
73
-
<row>
74
-
<entry>&Version;</entry>
75
-
<entry>&Description;</entry>
76
-
</row>
77
-
</thead>
78
-
<tbody>
79
-
&changelog.randomseed;
80
-
</tbody>
81
-
</tgroup>
82
-
</informaltable>
83
-
</para>
84
-
</refsect1>
85
-
<refsect1 role="examples">
86
-
&reftitle.examples;
87
-
<para>
88
-
<example>
89
-
<title><function>rand</function> example</title>
90
-
<programlisting role="php">
91
-
<![CDATA[
92
-
<?php
93
-
echo rand() . "\n";
94
-
echo rand() . "\n";
95
-

96
-
echo rand(5, 15);
97
-
?>
98
-
]]>
99
-
</programlisting>
100
-
&example.outputs.similar;
101
-
<screen>
102
-
<![CDATA[
103
-
7771
104
-
22264
105
-
11
106
-
]]>
107
-
</screen>
108
-
</example>
109
-
</para>
110
-
</refsect1>
111
-
<refsect1 role="seealso">
112
-
&reftitle.seealso;
113
-
<para>
114
-
<simplelist>
115
-
<member><function>srand</function></member>
116
-
<member><function>getrandmax</function></member>
117
-
<member><function>mt_rand</function></member>
118
-
</simplelist>
119
-
</para>
120
-
</refsect1>
121
-
</refentry>
122
-

123
-
<!-- Keep this comment at the end of the file
124
-
Local variables:
125
-
mode: sgml
126
-
sgml-omittag:t
127
-
sgml-shorttag:t
128
-
sgml-minimize-attributes:nil
129
-
sgml-always-quote-attributes:t
130
-
sgml-indent-step:1
131
-
sgml-indent-data:t
132
-
indent-tabs-mode:nil
133
-
sgml-parent-document:nil
134
-
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
135
-
sgml-exposed-tags:nil
136
-
sgml-local-catalogs:nil
137
-
sgml-local-ecat-files:nil
138
-
End:
139
-
vim600: syn=xml fen fdm=syntax fdl=2 si
140
-
vim: et tw=78 syn=sgml
141
-
vi: ts=1 sw=1
142
-
-->
143
0