C/C++获取时间戳

时间戳

秒级时间戳

time_t timestamp;
time(&timestamp);

毫秒级时间戳

clock_t timestamp=clock()*1000/CLOCKS_PER_SEC;

C/C++生成随机数

#include <stdlib.h>

srand((unsigned)time(0));
unsigned int index = rand();

发表评论