I am writing a mex file in which I need to essentially recreate Matlab's "randn" function. I used boost to do this, but am uncertain how to set the seed. Thus far I have:
boost::mt19937 rng; boost::normal_distribution<> nd(0, 1); boost::variate_generator >var_nor(rng, nd);
double rand_number = var_nor();
however, if I run a loop on this, I get the same sequence of random normals. I know I must seed it but am unsure how - I am getting an error if I use time(0)
Aucun commentaire:
Enregistrer un commentaire