| Description
This example shows how
to generate random numbers in a range
, in this case between 20 numbers
between 1 and 10.
Code
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
void main()
{
int x ;
srand((unsigned)time(NULL));
for(x=1;x<=20;x++)
printf("%i\t",rand()%10
+ 1);
}
Information
tested on Visual C++
6
|