fork(2) download
  1. #include <iostream>
  2. #include <random>
  3. #include <ctime>
  4. int main()
  5. {
  6. // no /dev/urandom access on ideone
  7. // std::random_device rd;
  8. std::mt19937 eng(std::time(NULL));
  9. std::normal_distribution<> dist(0.0, 3.0);
  10.  
  11. for(int n=0; n<20; ++n)
  12. std::cout << dist(eng) << ' ';
  13. }
  14.  
Success #stdin #stdout 0s 2828KB
stdin
Standard input is empty
stdout
-1.19899 0.458462 1.92567 -5.34213 2.18416 -2.51357 -1.54534 -3.45054 0.461406 -3.67148 -2.04973 0.252368 -2.61449 4.64473 1.02974 -2.98085 3.82683 -2.76612 2.73892 -6.9361