fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <random>
  4. #include <iomanip>
  5.  
  6. int main()
  7. {
  8. std::random_device device_random_;
  9. std::default_random_engine generator_(device_random_());
  10. std::normal_distribution<> distribution_x_(1.0, 0.5);
  11. std::normal_distribution<> distribution_y_(10.0, 1.0);
  12.  
  13. std::vector<double> vector_x_, vector_y_;
  14.  
  15. for (int counter_(0); counter_ < 10; ++counter_)
  16. {
  17. vector_x_.push_back(distribution_x_(generator_));
  18. vector_y_.push_back(distribution_y_(generator_));
  19. std::cout << std::fixed << std::setprecision(4) << "(" << vector_x_[counter_]
  20. << ", " << vector_y_[counter_] << ")\n";
  21. }
  22.  
  23. return (0);
  24. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
(0.2390, 10.3887)
(1.1087, 9.5847)
(1.0920, 9.3468)
(1.1982, 11.6633)
(0.8840, 11.0903)
(0.5573, 8.5121)
(0.6709, 11.4706)
(1.1477, 9.4374)
(0.8778, 11.0323)
(0.8255, 9.7704)