net.sourceforge.jeval.function.math
Class Random

java.lang.Object
  extended by net.sourceforge.jeval.function.math.Random
All Implemented Interfaces:
Function

public class Random
extends java.lang.Object
implements Function

This class is a function that executes within Evaluator. The function returns a random double value greater than or equal to 0.0 and less than 1.0. See the Math.random() method in the JDK for a complete description of how this function works.


Constructor Summary
Random()
           
 
Method Summary
 java.lang.String execute(Evaluator evaluator, java.lang.String arguments)
          Executes the function for the specified argument.
 java.lang.String getName()
          Returns the name of the function - "random".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Random

public Random()
Method Detail

getName

public java.lang.String getName()
Returns the name of the function - "random".

Specified by:
getName in interface Function
Returns:
The name of this function class.

execute

public java.lang.String execute(Evaluator evaluator,
                                java.lang.String arguments)
                         throws FunctionException
Executes the function for the specified argument. This method is called internally by Evaluator.

Specified by:
execute in interface Function
Parameters:
evaluator - An instance of Evaluator.
arguments - Not used.
Returns:
A random double value greater than or equal to 0.0 and less than 1.0.
Throws:
FunctionException - Thrown if the argument(s) are not valid for this function.


Copyright (C) 2002-2007 Robert Breidecker.