The Algorithms logo
The Algorithms
À proposFaire un don

Roulette Wheel Selection

function i = RouletteWheelSelection(p)
    r= rand*sum(p);
    c=cumsum(p);
    i=find(r<=c,1,'first');
end