@Override
	public int select(double[] score) {
		double m = 0;
		a += g;
//		System.out.println(a);
//		System.out.println(Arrays.toString(score));
		double max = Double.NEGATIVE_INFINITY;
		for (double s : score)
			if (s > max)
				max = s;
		for (double s : score)
			m += Math.exp(a*(s-max));
		double m0 = m * r.nextDouble();
		for (int i = 0; i < score.length; i++) {
			m -= Math.exp(a*(score[i]-max));
			if (m <= m0)
				return i;
		}
		return 0;
	}