会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
2014年5月27日
rand(7) 到rand(10)
摘要: 说有一个rand()函数,等概率生成1-7的随机数.利用这个函数,构造一个能生成1-10的随机数的函数; //意思大家都懂就好,没说清的就按照想象的走我想只要输出的10个数概率相同就好,从宏观上看,这个函数的返回值每个都是1/10就好.int get10(){ srand((...
阅读全文
posted @ 2014-05-27 15:44 13m0n
阅读(277)
评论(0)
推荐(0)
c++生成随机数
摘要: #include#include#include#define random(x) (rand()%x)void main(){ srand((int)time(0)); for(int x=0;x<10;x++) printf("%d/n",random(100...
阅读全文
posted @ 2014-05-27 15:31 13m0n
阅读(155)
评论(0)
推荐(0)
13m0n
公告
导航
博客园
首页
新随笔
联系
订阅
管理