一般随机化
srand(time(0));
x = rand();
[a , b) : x = rand() % (b - a) + a;
[a , b] : x = rand() % (b - a + 1) + a;
(a , b] : x = rand() % (b - a) + (a + 1);
(0 , 1] : x = rand() / double(RAND_MAX);
伪随机生成器 mt19937
mt19937 rnd(time(nullptr)); // 生成 uint32
mt19937_64 rnd(time(nullptr)); //生成 uint64
auto x = rnd();
//更强的随机种子
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
auto x = rnd();
标签:rand,mt19937,nullptr,rnd,随机化,time From: https://www.cnblogs.com/xqy2003/p/17443438.html