// Obsolete; use C++11 instead #include #include #include #include //typedef boost::mt19937 rng; typedef boost::lagged_fibonacci607 rng; double unirand(rng& gener){ // U[0,1) typedef boost::uniform_real<> dist_type; dist_type dist(0,1); boost::variate_generator random(gener, dist); return random(); } double gaussrand(rng& gener){ // Gaussian distribution typedef boost::normal_distribution<> dist_type; dist_type dist(0.0,1.0); boost::variate_generator random(gener, dist); return random(); } void format_output(std::ostream& out, unsigned decimals){ out << std::fixed< (std::time(0))); format_output(std::cout,30); std::cout<<" U[0,1):\n"; for(int i = 0; i < 10; i++) std::cout << unirand(gener) << "\n"; std::cout<<"\n\n Normal (Gaussian) distribution to file 'gauss'\n"; std::ofstream outfile("gauss"); format_output(outfile,30); for(int i = 0; i < 100; i++){ outfile<