有没有办法在int32_t
没有警告的情况下获得均匀分布?我uniform_int_distribution<int32_t>
在我的代码中使用它,但我收到一个警告:
54988961.cpp: In function ‘int main()’:
54988961.cpp:6:64: warning: overflow in conversion from ‘double’ to ‘int’ changes value from ‘1.0e+10’ to ‘2147483647’ [-Woverflow]
std::uniform_int_distribution<std::int32_t> unif(1,std::pow(10,10));
~~~~~~~~^~~~~~~
这正是我的代码:
#include <cmath>
#include <cstdint>
#include <random>
int main() {
std::uniform_int_distribution<std::int32_t> unif(1,std::pow(10,10));
}