编程珠玑--产生随机数

1747阅读 0评论2012-01-09 ranson_zop
分类:C/C++

 /**

 * main - 产生随机数

 * @num: 随机数个数

 * @size: 随机数范围0-size

 *

 * 

 * 

 *

 * CONTEXT:

 * Don't care.

 *

 * RETURNS:

 * Pointer to the found partition on success, NULL if not found.

 */

/*/

#include

#include

#include

#include

int

main(){

 

freopen("input.txt","r",stdin);

freopen("output.txt","w",stdout);

 

long i=0,num=0,size=2147483647;

scanf("%d%d",&num,&size);

if(num<=0)return;

 

srand((unsigned)time(NULL));

for(;i

printf(" %d",rand()%size);

}

fclose(stdin);

fclose(stdout);

}

/*/

上一篇:编程珠玑--七位随机数用位图排序
下一篇:输入输出acm