I am trying to use discrete distribution (here too. However as you see in the examples you do this by writing:
std::discrete_distribution<int> distribution {2,2,1,1,2,2,1,1,2,2};
or
std::discrete_distribution<> d({40, 10, 10, 40});
which is fine if you have 10 or four elements with weights. (also I don't know if the parenthesis are necessary)
But I want to use this for 1000 elements. I have these elements in a vector of structs such as:
struct Particle{
double weight;
};
std::vector<Particle> particles;
as you can see each element of this vector has a weight. I want to use that weight to initialize the discrete distribution.
I could go writing one by one in a very long sentence, but I don't think that is the way. How can I put the weights of the vector in the declaration of the discrete distribution?