小编Ars*_*rel的帖子

随机数字列表

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

int main()
{
   int i;
   int diceRoll;

   for(i=0; i < 20; i++)
   {
       printf("%d \n", rand());
   }

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是我在c(codeblocks)中编写的代码来获取随机数,问题是我总是得到相同的序列:41,18467,6334,26500等等...

我还在学习,所以请尝试解释,就像你正在和一个8岁的D谈话:

c c++ random codeblocks

4
推荐指数
1
解决办法
1923
查看次数

标签 统计

c ×1

c++ ×1

codeblocks ×1

random ×1