#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谈话: