public double observe() {
		RandomVariable unif = null;
		try {
			unif = new ContinuousUniform(0, 1);
		} catch (ParameterException e) {
			e.printStackTrace();
		}
		double u = unif.observe();
		int observed = 0;
		double cumulativeMass = 0;
		while (cumulativeMass < u) {
			cumulativeMass += mass(observed);
			observed++;
		}
		return observed - 1;
	}