public static int sampleScores(double[] beamScores) {
		// First get the normalization denominator
		double sum = 0;
		for (int i = 0; i < beamScores.length; i++) {
			sum += beamScores[i];
		}
		// Then normalize
		double[] normScores = new double[beamScores.length];
		for (int i = 0; i < beamScores.length; i++) {
			normScores[i] = beamScores[i] / sum;
		}

		// Bias the scores, normalize again
		sum = 0;
		for (int i = 0; i < normScores.length; i++) {
			normScores[i] = biasProb(normScores[i]);
			sum += normScores[i];
		}
		for (int i = 0; i < normScores.length; i++) {
			normScores[i] = normScores[i] / sum;
		}

		// Draw a random number and find the winner using Shannon/Miller/Selfridge
		double draw = Math.random();
		sum = 0;
		int winningIdx;
		for (winningIdx = 0; winningIdx < beamScores.length; winningIdx++) {
			sum += normScores[winningIdx];
			if (sum > draw) {
				break;
			}
		}

		return winningIdx;
	}