// (c) Copyright 1997 Peter Sandborn ALL RIGHTS RESERVED


//------------------------------------------------------------------------------
// MonteCarlo.java:
// This class contains functions that return a random number with the specified
// distribution.
//------------------------------------------------------------------------------


public class MonteCarlo
{
    private SetupButton parent;

    // Stuff used by ran1()
    public int idum;
    public int iff;
    public double[] r;
    public double ix1;
    public double ix2;
    public double ix3;

    // Constructors
    public MonteCarlo(SetupButton p,int seed)
    {
        parent = p;
        iff = 0;
        r = new double[98];

        // Initialize the sequence by setting idum to a negative number.
        if(seed == 0)
            idum = -1;
        if(seed < 0)
            idum = seed;
        else
            idum = -seed;
    }

    // Compute the required number of runs
    public int number_runs()
    {
		if(parent.monte_boolean)  {
			Integer I = Integer.valueOf(parent.monte_runs.getText());
			parent.number_monte_points = I.intValue();
			int i = parent.number_monte_points;
			if(i <= 0)
			    i = 1;
			return(i);
		}  else  
			return(1);
    }

    // Check to see if the desired confidence level has been met
    public boolean converge()
    {
        return(false);
    }
}