Same as a function rand(), functions Random() and setRandom() always generate same random values. Same as rand(), we can change seed of the random values by calling srand().
srand( (unsigned)time(NULL) ); // you need to include ctime or time.h Eigen::VectorXd x = Eigen::VectorXd::Random(m);