产生随机数//NULL大写,rand()在cstdlib,不在cmath

#include <cstdlib>
#include <time.h>
#include <iostream>
using namespace std;
//#include <cmath> 
int main()
{
    int i=0;
    srand(time(NULL));//Initialize random number generator
    while (i!=100) 
    {
        cout<<rand()<<endl;
        i++;
    }    
    cin.get();
    return 0;   
}  


 

原文地址:https://www.cnblogs.com/gitran/p/3644168.html