{"id":19036151,"url":"https://github.com/tx7do/test_weight_random","last_synced_at":"2025-10-06T17:09:42.157Z","repository":{"id":167386929,"uuid":"631921370","full_name":"tx7do/test_weight_random","owner":"tx7do","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-20T03:23:14.000Z","size":274,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-20T20:52:14.985Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tx7do.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T10:44:20.000Z","updated_at":"2023-05-21T03:23:39.000Z","dependencies_parsed_at":"2023-07-31T07:15:29.085Z","dependency_job_id":null,"html_url":"https://github.com/tx7do/test_weight_random","commit_stats":null,"previous_names":["tx7do/test_weight_random"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tx7do/test_weight_random","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_weight_random","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_weight_random/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_weight_random/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_weight_random/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tx7do","download_url":"https://codeload.github.com/tx7do/test_weight_random/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tx7do%2Ftest_weight_random/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278646783,"owners_count":26021512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T21:53:36.638Z","updated_at":"2025-10-06T17:09:42.112Z","avatar_url":"https://github.com/tx7do.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 加权随机（Weight random）算法\r\n\r\n1. Linear Scan（线性扫描）\r\n2. Binary Search（二叉查找）\r\n3. Hopscotch Selection（跳房子）\r\n4. Alias Method（别名方法）\r\n\r\n## Linear Scan（线性扫描）\r\n\r\n## Binary Search（二叉查找）\r\n\r\n## Hopscotch Selection（跳房子）\r\n\r\n## Walker-Vose Alias Method（别名方法）\r\n\r\n别名采样方法分为两个步骤：\r\n\r\n1. 做表；\r\n2. 根据表进行采样。\r\n\r\n## 参考资料\r\n\r\n- [权重随机（Weight random）算法详解](https://zhuanlan.zhihu.com/p/389788435)\r\n- [剑指 Offer II 071. 按权重生成随机数](https://github.com/doocs/leetcode/blob/main/lcof2/%E5%89%91%E6%8C%87%20Offer%20II%20071.%20%E6%8C%89%E6%9D%83%E9%87%8D%E7%94%9F%E6%88%90%E9%9A%8F%E6%9C%BA%E6%95%B0/README.md)\r\n- [Weighted Random: algorithms for sampling from discrete probability distributions](https://zliu.org/post/weighted-random/)\r\n- [Weighted random selection from array - stackoverflow](https://stackoverflow.com/questions/4463561/weighted-random-selection-from-array)\r\n- [Alias method - Wikipedia](https://en.wikipedia.org/wiki/Alias_method)\r\n- [alice golang version - github](https://github.com/liuzl/alias)\r\n- [Darts, Dice, and Coins: Sampling from a Discrete Distribution](https://www.keithschwarz.com/darts-dice-coins/)\r\n- [Alias Method: 在常数时间复杂度内非均匀地随机抽取元素](https://liam.page/2019/12/02/non-uniform-random-choice-in-constant-time-complexity/)\r\n- [A Faster Weighted Random Choice](https://blog.bruce-hill.com/a-faster-weighted-random-choice)\r\n- [从一次面试旁观说起--Weighted Random Sampling算法](https://brabalawuka.cc/posts/study/weighted_random/)\r\n- [基于权重 的随机选择算法](https://zhuanlan.zhihu.com/p/146216606)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftx7do%2Ftest_weight_random","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftx7do%2Ftest_weight_random","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftx7do%2Ftest_weight_random/lists"}