fork download
  1. #include <random>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6. std::random_device rd;
  7. std::mt19937 gen(rd());
  8. const double min_v = 0.0, max_v = 100.0;
  9. std::uniform_real_distribution<> dis(min_v, max_v);
  10. for (int n = 0; n < 20; ) {
  11. std::cout << dis(gen) << ' ';
  12. if( ++n % 5 == 0 ) std::cout << std::endl;
  13. }
  14. }
  15.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
77.1152 57.9325 56.4525 39.3826 19.1218 
31.1794 20.2642 85.6764 43.9968 0.324576 
48.1944 59.5096 2.75241 6.24386 30.7944 
50.8345 6.80453 26.2793 96.07 65.1047