An open API service providing repository metadata for many open source software ecosystems.

GitHub topics: non-replacement

ori88c/non-replacement-random-item-sampler

An efficient random item sampler that ensures O(1) sampling complexity, and equal selection probability for all items across cycles. Each cycle ensures unique, non-repeating item selections, with each item sampled only once per cycle. Upon cycle completion, the sampler automatically refreshes, initiating a new cycle to repeat the process.

Language: TypeScript - Size: 46.9 KB - Last synced at: 25 days ago - Pushed at: 6 months ago - Stars: 0 - Forks: 0

ori88c/non-replacement-weighted-random-item-sampler

A weighted random item sampler (selector), where the probability of selecting an item is proportional to its weight, and every item is sampled exactly once (without repetition or replacement). The sampling method utilizes a binary-search optimization, making it suitable for performance-demanding applications where the set of items is large.

Language: TypeScript - Size: 72.3 KB - Last synced at: 6 days ago - Pushed at: 6 months ago - Stars: 0 - Forks: 0