C++生成随机数

#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;



int main()

{

    cout<<time(0)<<endl;

    srand(time(0));

    for(int x=1; x<25; ++x) {

        cout<<1+(rand()%6)<<endl;

    }

    return 0;

}

 

你可能感兴趣的:(C++)