An open API service indexing awesome lists of open source software.

https://github.com/tx7do/test_weight_random


https://github.com/tx7do/test_weight_random

Last synced: 8 months ago
JSON representation

Awesome Lists containing this project

README

          

# 加权随机(Weight random)算法

1. Linear Scan(线性扫描)
2. Binary Search(二叉查找)
3. Hopscotch Selection(跳房子)
4. Alias Method(别名方法)

## Linear Scan(线性扫描)

## Binary Search(二叉查找)

## Hopscotch Selection(跳房子)

## Walker-Vose Alias Method(别名方法)

别名采样方法分为两个步骤:

1. 做表;
2. 根据表进行采样。

## 参考资料

- [权重随机(Weight random)算法详解](https://zhuanlan.zhihu.com/p/389788435)
- [剑指 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)
- [Weighted Random: algorithms for sampling from discrete probability distributions](https://zliu.org/post/weighted-random/)
- [Weighted random selection from array - stackoverflow](https://stackoverflow.com/questions/4463561/weighted-random-selection-from-array)
- [Alias method - Wikipedia](https://en.wikipedia.org/wiki/Alias_method)
- [alice golang version - github](https://github.com/liuzl/alias)
- [Darts, Dice, and Coins: Sampling from a Discrete Distribution](https://www.keithschwarz.com/darts-dice-coins/)
- [Alias Method: 在常数时间复杂度内非均匀地随机抽取元素](https://liam.page/2019/12/02/non-uniform-random-choice-in-constant-time-complexity/)
- [A Faster Weighted Random Choice](https://blog.bruce-hill.com/a-faster-weighted-random-choice)
- [从一次面试旁观说起--Weighted Random Sampling算法](https://brabalawuka.cc/posts/study/weighted_random/)
- [基于权重 的随机选择算法](https://zhuanlan.zhihu.com/p/146216606)