fork(1) download
  1. #include <iostream>
  2. #include <random>
  3.  
  4. double randnum (double aa, double bb) { //defining a function to create random numbers
  5. static std::random_device rd;
  6. std::mt19937 engine{ rd() };
  7. std::uniform_real_distribution<double> distribution (aa,bb);
  8. return distribution(engine);
  9. }
  10.  
  11. int main() {
  12. for(int i=1; i<50; i++) {
  13. std::cout<< randnum(0,1);
  14. }
  15. }
Success #stdin #stdout 0s 15248KB
stdin
Standard input is empty
stdout
0.298820.7327960.923270.9965780.9108550.134640.3351990.1309920.6286410.8756280.973830.8912450.1232940.9647160.5508420.8549780.9964950.1361680.8103880.4050660.2773390.6582710.2064220.4496480.4469030.1537310.6758120.6377420.6540870.3498940.9046170.2054420.6471080.1731840.4674310.4110940.9972850.2823980.5222410.6100670.7567070.07248440.5244930.1164080.09064990.1239320.1650080.2587370.6608