Could you send me the source code of "random" which used in C ?
think you.
Could you send me the source code of "random" which used in C ?
think you.
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char key;
int x ,counter=0;
time_t t;
srand(time( &t) );
while(counter<10 ) /*allows ten user inputs*/
{
x = (rand () %(30+1)); /*limits range of rondom numbers*/
printf("\n\tPress a Numerical Key for Random Number and press Enter : ");
scanf ("%i", &key);
printf("\n\tThe Random Number is: * %i *\n\n\t", x);
counter++;
}
return 0;
}
Take a look at the FAQ. It has some good threads on it.
1978 Silver Anniversary Corvette