Pick one index by rank-proportional (roulette) selection

.ga_pick(weights, total)

Arguments

weights

Numeric weights aligned to the (sorted) population.

total

Sum of weights.

Value

An integer index into the population.