随机浮点数范围[-5,5]可以取到-5.0和5.0
int main()
{
uniform_real_distribution<double> dis{-5,5};
mt19937 mt{ random_device{}() };
auto t = dis(mt);
cout << t <<endl;
return 0;
}
随机整数范围[-5,5]可以取到-5和5
int main()
{
uniform_int_distribution<int> dis{-5,5};
mt19937 mt{ random_device{}() };
auto t = dis(mt);
cout << t <<endl;
return 0;
}