第二节 · 铁索连环 · 变长元组tuple
#include <cstdlib>
#include <ctime>
void oldWay()
{
srand(time(0)); // 设置种子
for (int i = 0; i < 5; ++i)
{
cout << rand() % 100 << " "; // 0-99
}
// 问题:
// 1. rand() 的随机质量不高
// 2. 取模会导致分布不均匀
// 3. 不同平台的 RAND_MAX 不同
}引擎
说明
习题
Last updated