- #include <stdio.h>
-
#include <stdlib.h>
-
#include <string.h>
-
#include <sys/time.h>
-
int main()
-
{
-
struct timeval st;
-
gettimeofday( &st, NULL );
-
srand(st.tv_usec);
-
printf( "%d -> %d\n", st.tv_usec, 1 + rand() % 9 );
-
return 0;
- }
-
/*打印结果*/
-
-
/*
-
$ ./a.out
-
9
-
$ ./a.out
-
6
-
$ ./a.out
-
3
- $ ./a.out