第一种:rand() srand((unsigned int)time(0)); //设置随机种子 int a = rand()%10+ 1;//产生1-10的随机数 int a = rand()%10;//产生0- 9的随机数 int i=rand()%80+20;//产生20-100的随机数 int i=rand()%80+21;//产生21-100的随机数
以上就是聪慧狗最近收集整理的关于随机数的产生方法的全部内容,更多相关随机数内容请搜索靠谱客的其他文章。
发表评论 取消回复