fork(1) download
  1. #include <iostream>
  2. #include <random>
  3. #include <functional>
  4. #include <algorithm>
  5. #include <iterator>
  6.  
  7. #include <ctime>
  8.  
  9. int main() {
  10.  
  11. // Limity
  12. double min = 6.0;
  13. double max = 12.888;
  14.  
  15. // Generator liczb.
  16. std::mt19937 engine(std::time(NULL));
  17.  
  18. // Żądany rozkład.
  19. std::uniform_real_distribution<> dist(min, max);
  20.  
  21. // Żeby było prościej.
  22. auto gen = std::bind(dist, engine);
  23.  
  24. // 10 liczb.
  25. std::generate_n(std::ostream_iterator<double>(std::cout, " "), 10, gen);
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
8.89823 11.3506 6.90734 12.2335 6.51641 6.39271 10.3006 8.47956 11.4633 8.5496