您的位置:首页 > 其它

使用时间作为srand的种子制造随机数的案例

2012-03-21 23:06 429 查看
#include "stdlib.h"

#include "stdio.h"

#include "time.h"

int main(void)

{

  int i;

time_t temp_time;

srand((unsigned)time(&temp_time));

for(i = 0;i < 10; i++)

  {

   printf(" %d",rand()%1000);

}

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: