Skip to content

Commit

Permalink
Seed mersenne twister variable with random device
Browse files Browse the repository at this point in the history
  • Loading branch information
Shobuj-Paul committed Oct 14, 2023
1 parent 8f8a1ae commit 4f8c1b8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class MultivariateGaussian

int size_;
std::mt19937 rng_;
std::random_device rd_{};
std::normal_distribution<double> normal_dist_;
};

Expand All @@ -86,7 +87,7 @@ MultivariateGaussian::MultivariateGaussian(const Eigen::MatrixBase<Derived1>& me
const Eigen::MatrixBase<Derived2>& covariance)
: mean_(mean), covariance_(covariance), covariance_cholesky_(covariance_.llt().matrixL()), normal_dist_(0.0, 1.0)
{
rng_.seed(rand());
rng_.seed(rd_());
size_ = mean.rows();
}

Expand Down

0 comments on commit 4f8c1b8

Please sign in to comment.