随机数生成器

随机数生成器

#include <iostream>
using namespace std;
#include   <stdlib.h>
#include   <time.h>
#define MIN 1    //随机数产生的范围
#define MAX 100000

int main()
{
	//freopen("data.out","w",stdout);
   // cout<<"100000 100000"<<endl;
    srand((unsigned)time(NULL));
    for(int i=1; i<=100000;i++)          //产生随机数
    {
        int a=MIN + rand() % (MAX + MIN - 1);
        int b=MIN + rand() % (MAX + MIN - 1);
        if(a>b)swap(a,b);
        cout<<a<<' '<<b<<endl;
    }
    cout<<endl;
    return   0;
}

posted @ 2019-07-24 07:24  GavinZheng  阅读(520)  评论(0编辑  收藏  举报