@Override
	public Set<Integer> selectIndices(Population population, int numberOfPrograms) {
		if (numberOfPrograms > population.getSize()) {
			numberOfPrograms = population.getSize();
		}
		List<Double> fitnessList = population.getFitnesses();
		List<Double> normalizedFitnessList = new ArrayList<Double>();
		Random randomGenerator = new Random();
		Double totalFitness = 0.0;
		for (Double d: fitnessList) {
			totalFitness += d;
		}
		for (Double d : fitnessList) {
			normalizedFitnessList.add(d / totalFitness);
		}
		Set<Integer> selectedIndices = new HashSet<Integer>();
		while (selectedIndices.size() < numberOfPrograms) {
			Double randomNumber = randomGenerator.nextDouble();
			int i = -1;
			while (randomNumber > 0) {
				i++;
				randomNumber -= normalizedFitnessList.get(i);
			}
			selectedIndices.add(i);
		}
		return selectedIndices;
	}