rand产生随机数

  1. #include"stdio.h"
  2. #include"stdlib.h"
  3. void main()
  4. {
  5. int i;
  6. for(i=0;i<5;i++)
  7. printf("%d ",rand()%100);
  8. printf("\n");
  9. }

650) this.width=650;" border="0" alt="" src="http://img1.51cto.com/attachment/201112/221436719.png" />

srand设置随机事件的种子函数

  1. #include"stdio.h"
  2. #include"stdlib.h"
  3. #include"time.h"
  4. void main()
  5. {
  6. int i;
  7. time_t t;
  8. srand((unsigned) time(&t));
  9. for(i=0;i<5;i++)
  10. printf("%d ",rand()%100);
  11. printf("\n");
  12. }

650) this.width=650;" border="0" alt="" src="http://img1.51cto.com/attachment/201112/221400704.png" />

本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/735847

最新文章

  1. 设置DIV块元素在浏览器页面中垂直居中
  2. Hadoop 面试题之Hbase
  3. PHP 过滤 及 字符转换 函数
  4. 浏览器检测navigator 对象
  5. 《单页Web应用--温故JavaScrpt》学习笔记整理
  6. Python解决codeforces ---- 1
  7. lightoj 1010
  8. WebApp触屏版网站开发要点
  9. Ubuntu上安装QQ2015
  10. BZOJ 1212 HNOI 2004 L语言 Trie树
  11. CentOS python升级到3.5时yum报错
  12. 老李分享:robotium常用API 1
  13. [转]Docker基础-使用Dockerfile创建镜像
  14. xtrabackup 在线主从搭建
  15. Python中的exec、eval使用实例
  16. AngularJs 指令中 的Scope属性
  17. mvn编译
  18. [Luogu P1120]小木棍&#183;加强版
  19. webDriver API——第12部分WebElement
  20. mysqldump 命令使用

热门文章

  1. OAF页面隐藏右上角的全局按钮(主页,注销等)
  2. sklearn分类
  3. JS insertAdajcentHTML 方法简介
  4. JSTL 标签库 使用
  5. [CareerCup] 11.7 Tower of People in Circus 马戏团的人塔
  6. 连贯接口(fluent interface)的Java实现及应用。
  7. 【java基础】IOC介绍及其简单实现
  8. python selenuim使用代理的方式
  9. ”耐撕“团队 2016.3.21 站立会议3 2 1 GO!
  10. PHP ADLogin