in reply to Re: Weighted random numbers generator
in thread Weighted random numbers generator
There's no way you can possibly do it in better than O(n) time, since you're going to have to look at each weight at least once (otherwise, ((1)x100, 10000) wouldn't be treated properly).