vendredi 10 février 2017

Why use bitwise operations for sampling random without replacement in c#?

Example Select x random elements from a weighted list in C# (without replacement)

In this example of random sampling without replacement in c# why did the OP choose to use bitwise operations in the algorithm which counts the total weights and then selects which element is then to be chosen.

I searched the web for other examples of this algorithm but could not find any. Is it more efficient as it seems less readable from my perspective.

thanks.




Aucun commentaire:

Enregistrer un commentaire