Random Number Generation At Runtime in c
c --code
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
/* initialize random seed: */
srand ( time(NULL) );
printf("random number:%d,",rand()%20);
printf("%d,",rand()%30);
printf("%d,",rand()%40);
printf("%d\n",rand()%10);
return 0;
}
Comments
Post a Comment