reference/math/functions/mt-getrandmax.xml
2166824858a40ea664c558f2930b63b8f4fd89c6
...
...
@@ -1,82 +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 <function>mt_rand</function>
23
-
</para>
24
-
</refsect1>
25
-
<refsect1 role="examples">
26
-
&reftitle.examples;
27
-
<para>
28
-
<example><title>Calculate a random floating-point number</title>
29
-
<programlisting role="php">
30
-
<![CDATA[
31
-
<?php
32
-
function randomFloat($min = 0, $max = 1) {
33
-
return $min + mt_rand() / mt_getrandmax() * ($max - $min);
34
-
}
35
-

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

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