How to pick exactly* half of the item of a list with equity**?
(*)For a list of n item, if n is even, half is n/2. if n is odd, half is n/2 + 1.
The number of item in the list is more than 10^9. So n/2+1 is not close enought to n to be a noticable approximation.
(**)The principe of equity and fairness mean that every items of the list have the same probality of beeing pick.
I had a Equity Picker like this:
myList.Where(i => rand.NextDouble() >= 0.5);
but with this I can have more/less than half, with a slight chance of all /none of them.
Disclaimer: this is not an home work more a reflexion and modelisation around Thanos Random Picker
Aucun commentaire:
Enregistrer un commentaire