vendredi 25 octobre 2019

c++ Define a set of probability distributions in loop

I would like to create a set of normal distribution with different means. like this:

#include <random>
using namespace std;
std::default_random_engine generator;
std::normal_distribution<double> normal_1(0.0,std_1);
std::normal_distribution<double> normal_2(0.0,std_2);
// and so on until:
std::normal_distribution<double> normal_N(0.0,std_N);

I need to be able to change the total number of distributions so a loop will work better, like this:

for (int i = 1; i<=N; i++){
std::normal_distribution<double> normal_i(0.0,std_i);
}

PD: I'm new to C++, so maybe this is a very basic question.




Aucun commentaire:

Enregistrer un commentaire