fork(1) download
  1. #include <iostream>
  2. #include <random>
  3. #include <ctime>
  4. int main()
  5. {
  6. //std::random_device seed;
  7. //std::mt19937 rnd(seed()); // no access to hardware on ideone
  8. std::mt19937 rnd(std::time(NULL));
  9. std::uniform_real_distribution<> d(1, 2);
  10.  
  11. for(int n = 0; n < 10; ++n)
  12. std::cout << d(rnd) << ' ';
  13. std::cout << '\n';
  14. }
  15.  
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
1.23372 1.70192 1.07777 1.36155 1.55795 1.33086 1.76813 1.92 1.38191 1.09085