首页 > 其他 > 详细

【随机数】生成随机数模板

时间:2014-12-26 13:02:55      阅读:301      评论:0      收藏:0      [点我收藏+]

写个对拍程序的时候生成随机数的模板留在这儿

#include <cstdio>
#include <ctime>
#include <cstring>
#include <cstdlib>
#define Int(x, y) (rand() % (y-x+1) + x)
int x;

int main()
{
    freopen("debug.in", "w", stdout);
    srand((int)time(0));
    x = Int(1, 100);
    return 0;
}


【随机数】生成随机数模板

原文:http://blog.csdn.net/j_sure/article/details/42169633

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!