reference/csprng/functions/random-int.xml
2166824858a40ea664c558f2930b63b8f4fd89c6
...
...
@@ -1,121 +0,0 @@
1
-
<?xml version="1.0" encoding="utf-8"?>
2
-
<!-- $Revision$ -->
3
-

4
-
<refentry xml:id="function.random-int" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
-
<refnamediv>
6
-
<refname>random_int</refname>
7
-
<refpurpose>Generates cryptographically secure pseudo-random integers</refpurpose>
8
-
</refnamediv>
9
-

10
-
<refsect1 role="description"><!-- {{{ -->
11
-
&reftitle.description;
12
-
<methodsynopsis role="procedural">
13
-
<type>int</type><methodname>random_int</methodname>
14
-
<methodparam><type>int</type><parameter>min</parameter></methodparam>
15
-
<methodparam><type>int</type><parameter>max</parameter></methodparam>
16
-
</methodsynopsis>
17
-
<para>
18
-
Generates cryptographic random integers that are suitable for use where
19
-
unbiased results are critical, such as when shuffling a deck of cards for a
20
-
poker game.
21
-
</para>
22
-
&csprng.sources;
23
-
&csprng.function.backport;
24
-
</refsect1><!-- }}} -->
25
-

26
-
<refsect1 role="parameters"><!-- {{{ -->
27
-
&reftitle.parameters;
28
-
<variablelist>
29
-
<varlistentry>
30
-
<term><parameter>min</parameter></term>
31
-
<listitem>
32
-
<para>
33
-
The lowest value to be returned, which must be
34
-
<constant>PHP_INT_MIN</constant> or higher.
35
-
</para>
36
-
</listitem>
37
-
</varlistentry>
38
-
<varlistentry>
39
-
<term><parameter>max</parameter></term>
40
-
<listitem>
41
-
<para>
42
-
The highest value to be returned, which must be less than or equal to
43
-
<constant>PHP_INT_MAX</constant>.
44
-
</para>
45
-
</listitem>
46
-
</varlistentry>
47
-
</variablelist>
48
-
</refsect1><!-- }}} -->
49
-

50
-
<refsect1 role="returnvalues"><!-- {{{ -->
51
-
&reftitle.returnvalues;
52
-
<para>
53
-
Returns a cryptographically secure random integer in the range
54
-
<parameter>min</parameter> to <parameter>max</parameter>, inclusive.
55
-
</para>
56
-
</refsect1><!-- }}} -->
57
-

58
-
<refsect1 role="errors"><!-- {{{ -->
59
-
&reftitle.errors;
60
-
<itemizedlist>
61
-
&csprng.errors;
62
-
<listitem>
63
-
<simpara>
64
-
If <parameter>max</parameter> is less than <parameter>min</parameter>, an
65
-
<classname>Error</classname> will be thrown.
66
-
</simpara>
67
-
</listitem>
68
-
</itemizedlist>
69
-
</refsect1><!-- }}} -->
70
-

71
-
<refsect1 role="examples"><!-- {{{ -->
72
-
&reftitle.examples;
73
-
<example xml:id="random-int.example.basic"><!-- {{{ -->
74
-
<title><function>random_int</function> example</title>
75
-
<programlisting role="php">
76
-
<![CDATA[
77
-
<?php
78
-
var_dump(random_int(100, 999));
79
-
var_dump(random_int(-1000, 0));
80
-
?>
81
-
]]>
82
-
</programlisting>
83
-
&example.outputs.similar;
84
-
<screen>
85
-
<![CDATA[
86
-
int(248)
87
-
int(-898)
88
-
]]>
89
-
</screen>
90
-
</example><!-- }}} -->
91
-
</refsect1><!-- }}} -->
92
-

93
-
<refsect1 role="seealso"><!-- {{{ -->
94
-
&reftitle.seealso;
95
-
<simplelist>
96
-
<member><function>random_bytes</function></member>
97
-
</simplelist>
98
-
</refsect1><!-- }}} -->
99
-

100
-
</refentry>
101
-

102
-
<!-- Keep this comment at the end of the file
103
-
Local variables:
104
-
mode: sgml
105
-
sgml-omittag:t
106
-
sgml-shorttag:t
107
-
sgml-minimize-attributes:nil
108
-
sgml-always-quote-attributes:t
109
-
sgml-indent-step:1
110
-
sgml-indent-data:t
111
-
indent-tabs-mode:nil
112
-
sgml-parent-document:nil
113
-
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
114
-
sgml-exposed-tags:nil
115
-
sgml-local-catalogs:nil
116
-
sgml-local-ecat-files:nil
117
-
End:
118
-
vim600: syn=xml fen fdm=syntax fdl=2 si
119
-
vim: et tw=78 syn=sgml
120
-
vi: ts=1 sw=1
121
-
-->
122
0