This question is extension of the question below the link.
My question is sampling weighted random number with additional condition that the weights of each element are dynamically changed frequently.
EDIT Suppose there are N elements to pick with different weights.
For static weights, Walker's alias method requires O(N) time to setup the alias but sampling cost is O(1) so it is one of the best to achieve my goal.
And binary search method requires also O(N) to make cumulative array and sampling cost is log(N)
However in my case, because the weights are frequently changed, the time complexity to modifying weights is also important.
So I want to know there are existing library or algorithm with the time complexity for both modifying the data structure and sampling less than O(N).
EDIT While I read the comments, I realize I need to impose additional conditions. Each modification phase, only few numbers(mostly two) of weights are modified, also those modifications does not change the total sum of weight(normalization condition).
If there is a solution, I also want to know if it can be used when the weights are real numbers too.