KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nfunk > jep > function > Random


1 /*****************************************************************************
2
3 JEP - Java Math Expression Parser 2.3.0
4       October 3 2004
5       (c) Copyright 2004, Nathan Funk and Richard Morris
6       See LICENSE.txt for license information.
7
8 *****************************************************************************/

9 package org.nfunk.jep.function;
10
11 import java.lang.Math JavaDoc;
12 import java.util.*;
13 import org.nfunk.jep.*;
14 /**
15 * Encapsulates the Math.random() function.
16 */

17 public class Random extends PostfixMathCommand
18 {
19     public Random()
20     {
21         numberOfParameters = 0;
22
23     }
24
25     public void run(Stack inStack)
26         throws ParseException
27     {
28         checkStack(inStack);// check the stack
29
inStack.push(new Double JavaDoc(Math.random()));
30         return;
31     }
32 }
33
Popular Tags