std::srand((unsigned int)time(0)); MatrixXf r = MatrixXf::Random(num_gene, num_chro); 在代码前加一句srand即可,利用srand初始化随机数序列