// Random numbers using std // g++ -std=c++0x main_random.cpp utility.cpp stdrandom.cpp #include #include #include "std11_random.hpp" #include "utility.hpp" using namespace std; int main(){ ofstream outunif("unif"),outgauss("gauss"),outexpo("expo"); format_output(outunif,30); format_output(outgauss,30); format_output(outexpo,30); cout<<"U[0,1) to file 'unif'\n"; cout<<"Normal (Gaussian) distribution to file 'gauss'\n"; cout<<"Exponential distribution to file 'expo'\n"; for(int i = 0; i < 100000; i++) { outunif << unirand() << "\n"; outgauss << gaussrand() << "\n"; outgauss << gaussrand2() << "\n"; outexpo << exprand() << "\n"; } outunif.close(); outgauss.close(); outexpo.close(); cout< vran(100); generate(vran.begin(),vran.end(),unirand); // makes a copy of unirand() :( ofstream out("vran"); format_output(out,30); vector_out(vran,out); out.close(); return 0; }