srand(time(NULL));
时间: 2023-11-26 09:05:52 浏览: 52
VC随机函数srand和rand用法
5星 · 资源好评率100%
This line of code initializes the random number generator in C++. srand() stands for "seed random" and it takes a seed value as its argument. The seed value is usually based on the current time, which is why time(NULL) is passed as the argument. This ensures that each time the program is run, the random number generator will produce a different sequence of random numbers.
阅读全文