fork download
  1. #include <iostream>
  2. #include <random>
  3.  
  4. int main() {
  5. std::random_device rd;
  6. std::mt19937 gen(rd());
  7. std::uniform_real_distribution<> dis(1, 2);
  8. for (int n = 0; n < 10; ++n) {
  9. std::cout << dis(gen) << ' ';
  10. }
  11. std::cout << '\n';
  12. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
1.59943 1.84031 1.93186 1.91133 1.41412 1.19747 1.99144 1.33408 1.97006 1.44976