lundi 29 décembre 2014

Weighted sampling without replacement in PHP

If D denote the population of all items and |D|=n the total quantity of items, I want to take a random sample S of m=|S| elements, being m <= n. Each item in D has a weight attached, that represents its probability of appears in S.


Mi question is: What is the best algorithm (more efficent / easy to implement) keeping in mind n / 1k < n < 10k and all items will be in memory?





Aucun commentaire:

Enregistrer un commentaire