TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Data Structure for Dynamic Discrete Probability Distributions

1 pointsby jlrubinabout 2 months ago

1 comment

jlrubinabout 2 months ago
Options like std::discrete_distribution don&#x27;t allow updates, in Rust e.g. <a href="https:&#x2F;&#x2F;docs.rs&#x2F;rand_distr&#x2F;latest&#x2F;rand_distr&#x2F;weighted&#x2F;struct.WeightedTreeIndex.html" rel="nofollow">https:&#x2F;&#x2F;docs.rs&#x2F;rand_distr&#x2F;latest&#x2F;rand_distr&#x2F;weighted&#x2F;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.