samedi 22 octobre 2022

Swift random element with probability [duplicate]

It seems like randomElement() in Swift only allows for an equally weighted selection. What would be the best (and most efficient way, as I need to repeat this very often) to select from a collection with pre-specified probabilities/weights?




Aucun commentaire:

Enregistrer un commentaire