void Maker(int type) {
srand(time(0));
int T = random(1, 10); printf("%d\n", T);
while (T -- ) {
SubMaker(type);
}
}
int main() {
int type; scanf("%d\n", type);
for (int i = 1; i <= 5; i ++ ) {
string file = "data" + to_string(i) + ".in";
freopen(file.c_str(), "w", stdout);
Maker(type);
}
return 0;
}
这段代码会生成五个 .in 文件。然而这五个文件的数据全是相同的。
请问怎样才能在代码内多次重置随机种子,使得每次生成的数据都不同呢?