I have found this example on How to use boost normal distribution classes?
#include <boost/random.hpp>
#include <boost/random/normal_distribution.hpp>
int main()
{
boost::mt19937 rng; // I don't seed it on purpouse (it's not relevant)
boost::normal_distribution<> nd(0.0, 1.0);
boost::variate_generator<boost::mt19937&,
boost::normal_distribution<> > var_nor(rng, nd);
int i = 0; for (; i < 10; ++i)
{
double d = var_nor();
std::cout << d << std::endl;
}
}
I was wondering what do I have do add to the code to generate a different ran dom numbers each time . I am using the number called d produced , in a for cicle , but at every time I run the programm I obtain always the same numbers. Thank you!!!!
Aucun commentaire:
Enregistrer un commentaire