public PercolationStats(int N, int T)					// perform T independent computational experiments on an N-by-N grid
	{
		if (N<=0 || T<=0)
		{
			throw new IllegalArgumentException();
		}
		
		mean = 0;
		stddev = 0;
		confidenceLo = 0;
		confidenceHi = 0;
		
		double [] x = new double [T];
		double counter = 0;
		for (int t=0; t<T; t++)
		{
			Percolation test = new Percolation(N);
			while (!test.percolates())
			{
				int i = StdRandom.uniform(N)+1;
				int j = StdRandom.uniform(N)+1;
				
				if (!test.isOpen(i, j))
				{
					test.open(i, j);
					counter++;
				}
			}
			x[t] = counter/(N*N);
			counter = 0;
		}
		mean = StdStats.mean(x);
		stddev = StdStats.stddev(x);
		confidenceLo = mean - 1.96*stddev/Math.sqrt(T);
		confidenceHi = mean + 1.96*stddev/Math.sqrt(T);
	}