lsr-flying

相关函数:rand()函数, srand()函数

rand():返回一随机数值, 范围在0至RAND_MAX 间

void srand (unsigned int seed):设置rand()产生随机数时的随机数种子。

 

示例:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

void main()
{
     srand((int)time(0));                          
     for(int x=0;x<10;x++)
           printf("%d/n",rand()%100);
}

 

分类:

技术点:

相关文章:

  • 2021-10-28
  • 2021-12-16
  • 2021-10-01
猜你喜欢
  • 2021-10-01
  • 2021-12-16
  • 2021-10-01
相关资源
相似解决方案