Joined: Tue Mar 27, 2007 10:55 pm Posts: 2272 Location: Earth Has thanked: 39 time Have thanks: 61 time
Code:
/* 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); }
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )