function chrom= select(oldPop,stringlength,popsize)
totalFit = sum(oldPop(:,stringlength+2));
prob=oldPop(:,stringlength+2) / totalFit;
prob=cumsum(prob);
rns=sort(rand(popsize,1)); %Generate random
numbers
%Select individuals from the oldPop to the new
fitIn=1;newIn=1;
while newIn<=popsize
if rns(newIn)<prob(fitIn)
chrom(newIn,:) = oldPop(fitIn,:);
newIn = newIn+1;
else
fitIn = fitIn + 1;
end
end
return