/* RAND.C: This program seeds the random-number generator
 * with the time, then displays 10 random integers.
 */#include <stdlib.h>
#include <stdio.h>
#include <time.h>void main( void )
{
   int i;   /* Seed the random-number generator with current time so that
    * the numbers will be different every time we run.
    */
   srand( (unsigned)time( NULL ) );   /* Display 10 numbers. */
   for( i = 0;   i < 10;i++ )
      printf( "  %6d\n", rand() );
}
Output    6929
    8026
   21987
   30734
   20587
    6699
   22034
   25051
    7988
   10104

解决方案 »

  1.   

    随机数阿。就是随机的生成一个1到60000左右的一个整数。srand()是用来初始化随机数种子的。
      

  2.   

    产生随机数,种子由srand生成!
      

  3.   

    rand()产生伪随机数伪随机数是由一个确定的非随机计算过程产生的随机数
      

  4.   

    srandThe srand function sets the starting point for generating a series of pseudorandom integers. To reinitialize the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. rand retrieves the pseudorandom numbers that are generated. Calling rand before any call to srand generates the same sequence as calling srand with seed passed as 1.