blob: cc62f061a48fd2f54e3588ca69e0b8960c69b37a [file] [log] [blame]
<html>
<head>
<title>Velocity - MathTool</title>
<meta name="author" value="Gabriel Sidler"/>
<meta name="email" value="sidler@apache.org" />
</head>
<body bgcolor="#ffffff" text="#000000" link="#525D76"
alink="#525D76" vlink="#525D76">
<table border="0" width="100%" cellspacing="4">
<tr><td colspan="2">
<a href="http://jakarta.apache.org/">
<img src="http://jakarta.apache.org/images/jakarta-logo.gif"
align="left" alt="The Jakarta Project" border="0"/>
</a>
<a href="index.html">
<img src="../images/velocitygenerictools.png" align="right" alt="< Velocity Tools - Library >" border="0"/>
</a>
</td></tr>
<tr>
<td colspan="2">
<hr noshade="" size="1"/>
</td>
</tr>
<tr>
<td width="20%" valign="top" nowrap="true">
<p><strong><a href="../">Velocity Tools</a></strong></p>
<p>
<strong>Generic Tools</strong>
</p>
<ul>
<li><a href="index.html">Overview</a></li>
<li><a href="../index.html#Download">Download</a></li>
<li><a href="index.html#Contributions">Contributions</a></li>
<li><a href="../javadoc/index.html">Javadoc</a></li>
</ul>
<p>
<strong>Tool Documentation</strong>
</p>
<ul>
<li><a href="../javadoc/org/apache/velocity/tools/generic/DateTool.html">DateTool</a></li>
<li><a href="MathTool.html">MathTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/generic/NumberTool.html">NumberTool</a></li>
<li><a href="RenderTool.html">RenderTool</a></li>
<li><a href="EscapeTool.html">EscapeTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/generic/Alternator.html">Alternator</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/generic/AlternatorTool.html">AlternatorTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/generic/ValueParser.html">ValueParser</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/generic/ListTool.html">ListTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/generic/SortTool.html">SortTool</a></li>
<li><a href="../javadoc/org/apache/velocity/tools/generic/IteratorTool.html">IteratorTool</a></li>
</ul>
<p>
<strong>Other Subprojects</strong>
</p>
<ul>
<li><a href="../view/">VelocityView</a></li>
<li><a href="../struts/">VelocityStruts</a></li>
</ul>
<p>
</p>
</td>
<!-- RIGHT SIDE MAIN BODY -->
<td colspan="1" valign="top" align="left">
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="MathTool Reference Documentation">
<strong>MathTool Reference Documentation</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>Tool for performing floating point math in Velocity.</p>
<p>A few things to note:</p>
<ul>
<li>Most methods return numbers wrapped as Double
which automatically render the decimal places even
for whole numbers (e.g. new Double(1).toString() -&gt; '1.0').
This is intentional. This tool is for floating
point arithmetic. Integer arithmetic is already supported
by the Velocity template language. If you really need '1'
instead of '1.0', just call intValue() on the result.</li>
<li>No null pointer, number format, or divide by zero
exceptions are thrown here. This is because such exceptions
halt template rendering. It should be sufficient debugging
feedback that Velocity will render the reference
literally. (e.g. $math.div(1, 0) renders as '$math.div(1, 0)')</li>
<li>Class <code>java.lang.Math</code> is used to perform the
mathematical operations.</li>
</ul>
<table cellpadding="0" cellspacing="0">
<tr><td colspan="2"><strong>Class</strong></td></tr>
<tr><td>&nbsp;</td><td>org.apache.velocity.tools.generic.MathTool</td></tr>
<tr><td colspan="2"><strong>Name</strong></td></tr>
<tr><td>&nbsp;</td><td>$math (this is the recommended name of the tool in
the Velocity context)</td></tr>
<tr><td colspan="2"><strong>Toolbox Configuration Example</strong></td></tr>
<tr><td>&nbsp;</td><td><pre>&lt;tool&gt;
&lt;key&gt;math&lt;/key&gt;
&lt;scope&gt;application&lt;/scope&gt;
&lt;class&gt;org.apache.velocity.tools.generic.MathTool&lt;/class&gt;
&lt;/tool&gt;</pre></td></tr>
<tr><td colspan="2"><strong>Author(s)</strong></td></tr>
<tr><td>&nbsp;</td><td><a href="mailto:nathan@esha.com">Nathan Bubna</a><br></td></tr>
</table>
<dl>
<dt><strong>Method Overview</strong></dt>
<dd>
<table cellpadding="2" cellspacing="2" border="0">
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#add()">add()</a></td>
<td bgcolor="EEEEEE">
Addition
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#sub()">sub()</a></td>
<td bgcolor="EEEEEE">
Subtraction
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#mul()">mul()</a></td>
<td bgcolor="EEEEEE">
Multiplication
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#div()">div()</a></td>
<td bgcolor="EEEEEE">
Division
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#pow()">pow()</a></td>
<td bgcolor="EEEEEE">
Power of
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#max()">max()</a></td>
<td bgcolor="EEEEEE">
Maximum of two numbers
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#min()">min()</a></td>
<td bgcolor="EEEEEE">
Minimum of two numbers
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#abs()">abs()</a></td>
<td bgcolor="EEEEEE">
Absolute value of a number
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#toDouble()">toDouble()</a></td>
<td bgcolor="EEEEEE">
Converts a number into a double.
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#toInteger()">toInteger()</a></td>
<td bgcolor="EEEEEE">
Converts a number into an integer
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#roundTo()">roundTo()</a></td>
<td bgcolor="EEEEEE">
Rounds a number to the specified number of decimal places
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#roundToInt()">roundToInt()</a></td>
<td bgcolor="EEEEEE">
Rounds a number to the nearest whole Integer
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#getRandom()">getRandom()</a></td>
<td bgcolor="EEEEEE">
Returns a pseudo-random number
</td>
</tr>
<tr>
<td bgcolor="EEEEEE" nowrap>
<a href="#random()">random()</a></td>
<td bgcolor="EEEEEE">
Returns a pseudo-random number in a configurable range
</td>
</tr>
</table>
</dd>
</dl>
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="add()">
<strong>add()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Addition
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double add(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
Operands of the addition. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the sum or <code>null</code> if the input
paramters are not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="sub()">
<strong>sub()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Subtraction
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double sub(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
Operands of the subtraction. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the result of the subtraction
or <code>null</code> if the input paramters are not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="mul()">
<strong>mul()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Multiplication
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double mul(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
Factors of the multiplication. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the result of the multiplication
or <code>null</code> if the input paramters are not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="div()">
<strong>div()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Division
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double div(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
Input for the division. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the result of the division
or <code>null</code> if the input paramters are not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="pow()">
<strong>pow()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Power of
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double pow(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
Operands. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the first number raised to
the power of the second or <code>null</code> if the input paramters are not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="max()">
<strong>max()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Maximum of two numbers
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double max(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
Operands. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the maximum of the two
numbers or <code>null</code> if the input paramters are not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="min()">
<strong>min()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Minimum of two numbers
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double min(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
Operands. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the minimum of the two
numbers or <code>null</code> if the input paramters are not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="abs()">
<strong>abs()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Absolute value of a number
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double abs(Object num)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num</dt>
<dd>
<parameter name="num">
Operand. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the absolute value of the
input or <code>null</code> if the input paramter is not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="toDouble()">
<strong>toDouble()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Converts a number into a double.
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double toDouble(Object num)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num</dt>
<dd>
<parameter name="num">
Operand. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the input number or
<code>null</code> if the input paramter is not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="toInteger()">
<strong>toInteger()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Converts a number into an integer
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Integer toInteger(Object num)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num</dt>
<dd>
<parameter name="num">
Operand. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Integer</code> representing the input number or
<code>null</code> if the input paramter is not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="roundTo()">
<strong>roundTo()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Rounds a number to the specified number of decimal places
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double roundTo(Object decimals, Object num)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>decimals</dt>
<dd>
<parameter name="decimals">
The number of decimal places. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
<dt>num</dt>
<dd>
<parameter name="num">
The number to round. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code> representing the input number
rounded to the specified number of decimal places or
<code>null</code> if the input paramter is not valid.
</returns>
</dd>
</dl>
<p>This method is particulary useful for simple display formatting.
If you want to round an number to the nearest integer, it
is better to use method <code><a href="#roundToInt()">roundToInt()</a></code>,
as that will return an <code>java.lang.Integer</code> rather than
a <code>java.lang.Double</code>.</p>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="roundToInt()">
<strong>roundToInt()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Rounds a number to the nearest whole Integer
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Integer roundToInt(Object num)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num</dt>
<dd>
<parameter name="num">
The number to round. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Integer</code> representing the input number
rounded to nearest whole Integer or <code>null</code> if the input paramter is not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="getRandom()">
<strong>getRandom()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns a pseudo-random number
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Double getRandom()
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Double</code>
greater than or equal to 0.0 and less than 1.0.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr>
<td colspan="2" bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica.sanserif">
<a name="random()">
<strong>random()</strong></a></font>
</td>
</tr>
<tr>
<td NOWRAP> &nbsp; &nbsp; &nbsp; &nbsp; </td>
<td>
<p>
<abstract>
Returns a pseudo-random number in a configurable range
</abstract>
</p>
<p>
<table width="100%"><tr><td bgcolor="EEEEEE">
<font size="+1"><code>
<signature>
Integer random(Object num1, Object num2)
</signature>
</code></font>
</td></tr></table>
</p>
<dl>
<dt><strong>Parameters</strong></dt>
<dd>
<dl>
<dt>num1, num2</dt>
<dd>
<parameter name="num1, num2">
First and last number of range. Valid input is any number (primitive
types or objects, Velocity automatically converts primitives types
to objects) or a string representation of a number.
</parameter>
</dd>
</dl>
</dd>
</dl>
<dl>
<dt><strong>Returns</strong></dt>
<dd>
<returns>
A <code>java.lang.Integer</code> greater than or equal to the first
number and less than the second number or <code>null</code> if the input paramter
is not valid.
</returns>
</dd>
</dl>
<br clear="all">
</td>
</tr>
</table>
</td>
</tr>
<!-- FOOTER SEPARATOR -->
<tr>
<td colspan="2">
<hr noshade="" size="1"/>
</td>
</tr>
<!-- PAGE FOOTER -->
<tr><td colspan="2">
<div align="center"><font color="#525D76" size="-1"><em>
Copyright &#169; 1999-2003, Apache Software Foundation
</em></font></div>
</td></tr>
</table>
</body>
</html>