//RandFunctionWrapper.java
//wrapper class for a random function

public class RandFunctionWrapper
{

	int lowBound = 0;
	int upperBound = 0;
	int seed = 0;

	//the randomizer being tested
	java.util.Random r;

	public RandFunctionWrapper( int lowBound, int upperBound, int seed)
	{
		if (lowBound >= upperBound)
		{
			System.out.println("sanity check: you passed upper bound " + upperBound + " and lower bound " + lowBound);
		}
		this.lowBound = lowBound;
		this.upperBound = upperBound;
		this.seed = seed;
		initialize();
	}

	public void initialize()
	{
		//create and initialize random number generator

		r = new java.util.Random(seed);

	}

	public int getInt()
	{
		int randomInt = r.nextInt();
		randomInt = Math.abs(randomInt); //absolute value -- ensures positive values
		int interval = upperBound - lowBound; //find the range of values

				//trim the value to fit and adjust to lower bound
		return ((randomInt % interval) + lowBound ) ;	

	}
	
	public static void main(String[] argv)
	{
		RandFunctionWrapper rfw0 = new RandFunctionWrapper(100,  0, 1);
		RandFunctionWrapper rfw1 = new RandFunctionWrapper(0,  0, 1);
		RandFunctionWrapper rfw2 = new RandFunctionWrapper(0, 100, 1);
		for (int i = 0; i < 10; i++)
		{
			System.out.print (" " + rfw2.getInt());
		}
		System.out.println();
		RandFunctionWrapper rfw3 = new RandFunctionWrapper(-100, 100, 1);
		for (int i = 0; i < 10; i++)
		{
			System.out.print (" " + rfw3.getInt());
		}
	}

}