C语言rand()函数产生随机数

#include <stdlib.h> #include <time.h> int main() { int i; srand((unsigned)time(NULL)); for (i=0;i<10;i++) printf("%d\n",rand()%6+1); return 0; } //产生1~6之间的随机数; 运行结果:php 根据百度百科,库函数中系
相关文章
相关标签/搜索