reference/math/functions/mt-getrandmax.xml
2166824858a40ea664c558f2930b63b8f4fd89c6
...
...
@@ -1,85 +0,0 @@
1
-
<?xml version="1.0" encoding="utf-8"?>
2
-
<!-- $Revision$ -->
3
-
<refentry xml:id="function.mt-getrandmax" xmlns="http://docbook.org/ns/docbook">
4
-
<refnamediv>
5
-
<refname>mt_getrandmax</refname>
6
-
<refpurpose>Show largest possible random value</refpurpose>
7
-
</refnamediv>
8
-
<refsect1 role="description">
9
-
&reftitle.description;
10
-
<methodsynopsis>
11
-
<type>int</type><methodname>mt_getrandmax</methodname>
12
-
<void/>
13
-
</methodsynopsis>
14
-
<simpara>
15
-
Returns the maximum value that can be returned by a call to
16
-
<function>mt_rand</function>.
17
-
</simpara>
18
-
</refsect1>
19
-
<refsect1 role="returnvalues">
20
-
&reftitle.returnvalues;
21
-
<para>
22
-
Returns the maximum random value returned by a call to
23
-
<function>mt_rand</function> without arguments, which is the maximum value
24
-
that can be used for its <parameter>max</parameter> parameter without the
25
-
result being scaled up (and therefore less random).
26
-
</para>
27
-
</refsect1>
28
-
<refsect1 role="examples">
29
-
&reftitle.examples;
30
-
<para>
31
-
<example><title>Calculate a random floating-point number</title>
32
-
<programlisting role="php">
33
-
<![CDATA[
34
-
<?php
35
-
function randomFloat($min = 0, $max = 1) {
36
-
return $min + mt_rand() / mt_getrandmax() * ($max - $min);
37
-
}
38
-

39
-
var_dump(randomFloat());
40
-
var_dump(randomFloat(2, 20));
41
-
?>
42
-
]]>
43
-
</programlisting>
44
-
&example.outputs.similar;
45
-
<screen>
46
-
<![CDATA[
47
-
float(0.91601131712832)
48
-
float(16.511210331931)
49
-
]]>
50
-
</screen>
51
-
</example>
52
-
</para>
53
-
</refsect1>
54
-
<refsect1 role="seealso">
55
-
&reftitle.seealso;
56
-
<para>
57
-
<simplelist>
58
-
<member><function>mt_rand</function></member>
59
-
<member><function>mt_srand</function></member>
60
-
<member><function>getrandmax</function></member>
61
-
</simplelist>
62
-
</para>
63
-
</refsect1>
64
-
</refentry>
65
-

66
-
<!-- Keep this comment at the end of the file
67
-
Local variables:
68
-
mode: sgml
69
-
sgml-omittag:t
70
-
sgml-shorttag:t
71
-
sgml-minimize-attributes:nil
72
-
sgml-always-quote-attributes:t
73
-
sgml-indent-step:1
74
-
sgml-indent-data:t
75
-
indent-tabs-mode:nil
76
-
sgml-parent-document:nil
77
-
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
78
-
sgml-exposed-tags:nil
79
-
sgml-local-catalogs:nil
80
-
sgml-local-ecat-files:nil
81
-
End:
82
-
vim600: syn=xml fen fdm=syntax fdl=2 si
83
-
vim: et tw=78 syn=sgml
84
-
vi: ts=1 sw=1
85
-
-->
86
0