mardi 28 mai 2019

Does std::discrete_distribution() allow zero weights?

Can std::discrete_distribution be used with some zero weights, assuming that at least one positive weight was given? The items with zero weights should simply never be sampled.

The fact that it appears to work on my machine does not give me confidence that it will work on all systems.

Example:

std::discrete_distribution<> dd({1.0, 2.0, 0.0, 3.0});




Aucun commentaire:

Enregistrer un commentaire