Fri Apr 29, 2011 10:47 pm
/* srand example */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include<windows.h>
int main ()
{
printf ("Random value is : %d\n", rand() % 100);
// setting the random generator seed.
srand ( time(NULL) );
printf ("Random value is: %d\n", rand() % 100);
// setting the random generator seed.
srand ( 1 );
printf ("Random value is: %d\n", rand() %100);
// sleep to watch the time .
Sleep(9000);
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.