Is there a way to do nice and elegant weighted shuffling using standard library? There is std::discrete_distribution
. What I want is something like this:
std::vector<T> data { N elements };
std::vector<int> weights { N weights };
std::shuffle(std::begin(data), std::end(data), something based on discrete distribution);
Aucun commentaire:
Enregistrer un commentaire