
as shown above, the d >= randomWeight should be d > randomWeight
It is going to cause a probability error.
if totalWeight == X+Y+Z , weights = [X, X+Y, X+Y+Z]
d >= randomWeight split ranges like [0, X], (X, X+Y], (X+Y, X+Y+Z)
d > randomWeight split ranges like [0, X), [X, X+Y),[X+Y, X+Y+Z)
as we know, the randomWeight is a random number in [0, X+Y+Z)
it means when d >= randomWeight first range's probability will be large than the weight/totalWeight
and last range's probability will be less than the weight/totalWeight
so the correct is d > randomWeight
the fix commit #376
as shown above, the
d >= randomWeightshould bed > randomWeightIt is going to cause a probability error.
if totalWeight == X+Y+Z , weights = [X, X+Y, X+Y+Z]
d >= randomWeightsplit ranges like [0, X], (X, X+Y], (X+Y, X+Y+Z)d > randomWeightsplit ranges like [0, X), [X, X+Y),[X+Y, X+Y+Z)as we know, the randomWeight is a random number in [0, X+Y+Z)
it means when
d >= randomWeightfirst range's probability will be large than the weight/totalWeightand last range's probability will be less than the weight/totalWeight
so the correct is
d > randomWeightthe fix commit #376