[SR-Users] LCR "weight" column question
Juha Heinanen
jh at tutpro.com
Fri Sep 24 09:43:23 CEST 2010
Ricardo Martinez writes:
> As you can see there is no a 20,20,20,20,10,10 call repartition.
> Could this be a bug?
ricardo,
it is a "feature" of the way randomized weights are currently
calculated. if you have two wgs with weights 1 and 2 and then generate
two random numbers
1 * random number
2 * random number
then the probability that the latter result is less than 10 is 50 %, but
that it also is less than the first number is only 25 %.
i searched around a bit and didn't find any fast way to calculate a
better weighted random number. the algorithms i found where based on an
idea of creating an array of gws where each gw appears in the array as
many times as its weight is and then a random number is generated
between [1, size of the array] and a gw in that random number index of
the array is selected.
any ideas on how to improve weighted random number calculation without
loosing performance?
-- juha
More information about the sr-users
mailing list