更新时间:2023-02-10 13:34:26
Based on the already mentioned solution, here is a version adapted to your specific needs:
double doubleRand(double min, double max) {
thread_local std::mt19937 generator(std::random_device{}());
std::uniform_real_distribution<double> distribution(min, max);
return distribution(generator);
}