1
0

23_randomcpp11.cpp 317 B

12345678910111213141516
  1. #include <iostream>
  2. #include <random>
  3. using namespace std;
  4. int main()
  5. {
  6. random_device rd;
  7. mt19937 rng(rd());
  8. uniform_real_distribution<double> dist(0.0, 2.0);
  9. cout << "Generating 5 random numbers in [0.0; 2.0) range" << endl;
  10. for (int i = 0; i < 5; i++)
  11. cout << dist(rng) << " ";
  12. cout << endl;
  13. return 0;
  14. }