jeudi 1 janvier 2015

Generation of Multivariate normal distributed random numbers in c++

I've been trying to find a way to sample random vectors from a multivariate normal distribution in C++, having both the mean vector and the covariance matrix, much like Matlab's mvnrnd function works. I've found relevant code for a class that implements this on


Error while creating object from templated class


but the code seems to generate same random numbers each time. There is also a discussion following the same question where @JCooper suggest to add Eigen::internal::scalar_normal_dist_op::rng.seed((int)time(0)); to the code but i am unable to figure out where to add the code so that whenever i call samples i can generate new random numbers following normal distribution .





Aucun commentaire:

Enregistrer un commentaire