This question already has an answer here:
The question itself is pretty straightforward.
I know that I could generate a random value R between 0 and the size of the container, create an iterator over it and advance it by R, but this seems to be O(R) and I think there could be a faster way to get random elements inside an unordered_set.
Aucun commentaire:
Enregistrer un commentaire