您的位置:首页 > 其它

time() srand() rand()

2010-08-13 10:13 225 查看
time()
返回系统当前时间,从1970年1月1日0时0分算起

如: temptime=time(NULL); // 可以写成 time(&temptime)

常用于随机数产生作为种子

如: srand((usigned) time(NULL));
又如:srand(time(&temptime) %60);
t = rand() % 52 //随机取0-52之间数
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: