Options like std::discrete_distribution don't allow updates, in Rust e.g. <a href="https://docs.rs/rand_distr/latest/rand_distr/weighted/struct.WeightedTreeIndex.html" rel="nofollow">https://docs.rs/rand_distr/latest/rand_distr/weighted/struct...</a> allows updates but sampling is O(log n) and updating is also O(log n).<p>This neat data structure has a great set of tradeoffs.