C++ 随机数

#include <iostream>
#include <stdlib.h>
#include <time.h>

#define random(a,b) (rand() % (b-a) + a)

using namespace std;

int main()
{
    srand((unsigned)time(NULL));
    for(int i=0; i<10; i++)
        cout << random(1,100) << "	" << rand()/double(RAND_MAX) << endl;
}
原文地址:https://www.cnblogs.com/lged/p/5803027.html