fork download
  1. #include <iostream>
  2. #include <random>
  3. #include <ctime>
  4. using namespace std;
  5. int main() {
  6. // hardware access is disabled at ideone.com, will seed with time instead
  7. // random_device rd; // access hardware RNG
  8. // default_random_engine e(rd()); // seed the software PRNG
  9. default_random_engine e(time(NULL)); // seed the software PRNG
  10. uniform_real_distribution<> d(-1, 1); // range
  11. for(int n = 0; n<100; ++n)
  12. cout << d(e) << ' ';
  13. cout << '\n';
  14. }
  15.  
Success #stdin #stdout 0s 2828KB
stdin
Standard input is empty
stdout
0.447182 -0.777562 -0.33337 0.790846 0.651003 -0.341544 0.404603 0.811189 0.996922 0.257911 -0.660934 -0.912407 0.0968786 0.51791 -0.927101 -0.180351 -0.364522 0.968398 0.849882 -0.965417 -0.788234 -0.77889 0.285111 -0.315101 0.833067 -0.723244 -0.584334 -0.158502 -0.802364 -0.477736 -0.129765 -0.975816 0.0272153 -0.398556 0.341949 0.0705561 0.550687 0.283349 -0.439756 0.540862 0.300876 0.605526 -0.183558 0.353689 -0.936062 0.306991 0.522481 0.191065 0.519407 -0.465935 -0.412113 0.864135 0.114531 0.28989 0.330939 -0.277437 -0.647511 0.215518 -0.248843 0.453578 0.242147 -0.648816 -0.461467 0.799256 0.134586 -0.104402 -0.778844 -0.542494 -0.150658 0.918838 0.694128 0.135687 -0.218238 -0.9326 0.408232 -0.860716 0.916107 -0.701975 0.725942 -0.675682 0.0599473 0.359908 -0.466977 0.303684 -0.399213 -0.266347 -0.0174886 -0.174977 0.0946597 0.275914 0.923376 0.845489 0.454529 -0.370491 -0.444503 0.646161 0.830311 0.855734 0.611747 0.383502