时间种子的随机数的生成,需要#include <time.h>。
#include <time.h> time_t ts; unsigned int num = time(&ts); srand(num); // 或者 srand((unsigned int)(time(NULL)));
时间种子的随机数的生成,需要#include <time.h>。
#include <time.h> time_t ts; unsigned int num = time(&ts); srand(num); // 或者 srand((unsigned int)(time(NULL)));
相关文章: