class UniformStochasticSelectionOperator extends AbstractSelectionOperator {

    public Population[] select(Population[] populations) {
        checkConsistency(populations);

        // unify populations for easy linear access to all input Individuals
        Individual[] inputIndividuals = this.concatenateIndividualsFromPopulations(populations, this.inputArity);
        int inputSize = inputIndividuals.length;
        int resultSize = this.getOutputArity() * this.getIndividualsPerPopulation();
        List<Individual> selectedIndividuals = new ArrayList<Individual>(resultSize);
        // random selection of Individuals from input
        for (int i = 0; i < resultSize; i++){
            selectedIndividuals.add(inputIndividuals[this.randomGenerator.nextInt(inputSize)]);
        }

        // wrapping result into return values
        Population[] outputPopulations = this.createOutputPopulations();
        Individual[][] outputIndividuals = this.createOutputIndividuals();
        this.mapByColumns(selectedIndividuals, outputIndividuals);
        this.assignIndividualsToPopulations(outputIndividuals, outputPopulations);

        return outputPopulations;
    }

}