|
发表于 2015-1-19 18:40:08
|
显示全部楼层
- #include <stdio.h>
- #include <stdlib.h>:loveliness:
- #include <time.h>
- int main(void)
- {
- int i;
- randomize();
- printf("ten random numbers from 0 to 99\n\n");
- for (i=0; i<10; i++)
- printf("%d\n",rand() % 100);
- return 0;
- }
复制代码
=======================================
======================================
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #define N 10
- main()
- {
- int i;
- srand(time(0)); /*设置种子,并生成伪随机序列*/
- for(i=0;i<N;++i)
- printf("%d\n",rand()%100);
- system("pause");
- }
复制代码 |
|