This question already has an answer here:
Before you just flag it as duplicate, other questions weren't interested in a specific probability distribution
So, if I need to create a function that, let's say
vector<double> func(int input){
random_device mch;
default_random_engine generator(mch());
vector<double> vec;
for (int i = 0; i < input; i++){
normal_distribution<double> distribution(0.0,2.0);
vec.push_back(distribution(generator));
}
return vec;
}
I need to execute this function several times. If at first gives me, say, (5,2,89,20) vector, then no matter how many times I execute this function, I still get the same (5,2,89,20) vector How do I make it so it generates a random number each time?
Aucun commentaire:
Enregistrer un commentaire