使用时间作为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;
}
#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;
}
相关文章推荐
- golang使用时间作为种子生成随机数
- go使用时间作为种子生成随机数
- go使用时间作为种子生成随机数
- 用srand时间数种子来生成随机数
- C++中的srand(time(null))利用时间设置随机种子产生随机数
- 时间作为种子(随机数的产生)
- C++产生m到n之间的随机数,产生0到100之间的随机数,以系统时间作为随机种子
- C++中的srand(time(null))利用时间设置随机种子产生随机数
- C++中的srand(time(null))利用时间设置随机种子产生随机数
- C++中的srand(time(null))利用时间设置随机种子产生随机数
- C++中的srand(time(null))利用时间设置随机种子产生随机数 http://blog.csdn.net/youoran/article/details/10950671
- 财富500强的前10个公司里有8个公司在使用Qt(Qt自己认为的优点是:直觉主义、跨平台、节省时间),以及一些商业案例
- C/C++随机数rand()和种子函数srand()
- 1.(c语言)产生随机数(rand()和srand()的配合使用)
- MFC使用多线程时请谨慎使用srand()来产生随机数
- 批处理、shell 使用日期时间作为文件名的方法
- 一个使用上传图片插件,图文编辑,时间插件的综合案例
- C++ 随机数,根据时间生成随机数,Srand 与Rand 产生随机数
- srand(设置随机数种子)
- JavaSE8基础 Random 使用给定的种子产生随机数