The rand() function returns a pseudo-random integer in the range 0 to RAND_MAX inclusive.(来自man手册)

1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <time.h>
4 int main (void)
5 {
6     srand(time(NULL));
7     printf("%d\n", 2*(rand () % 25000));
8     return 0;
9 }

 

 

posted on 2013-04-21 16:10  宇睿  阅读(272)  评论(0编辑  收藏  举报