会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
comeby
博客园
首页
新随笔
联系
订阅
管理
2011年9月14日
rand()与srand()
摘要: 标准库中包含一个可移植的实现伪随机数发生器的函数rand以及一个初始化种子数的函数srand。 unsigned long int next = 1;/*rand函数:返回0~32767之间的伪随机数*/int rand(void){ next = next * 1103515245 + 12345; return (unsigned int)(next/65535)%32768;}/*sran...
阅读全文
posted @ 2011-09-14 10:44 comeby
阅读(729)
评论(0)
推荐(0)
编辑