fork download
  1. #include <iostream>
  2. #include <random>
  3.  
  4. int main()
  5. {
  6. std::mt19937 rng(std::random_device{}()); // the PRNG
  7. std::normal_distribution<double> dist; // a distribution
  8.  
  9. // Print 100 standard-normally distributed numbers.
  10. for (int i = 0; i != 100; ++i)
  11. {
  12. std::cout << dist(rng) << '\n';
  13. }
  14. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
-0.231494
1.7892
0.374915
0.588446
-0.442755
-0.0794823
-0.200291
-0.275413
-1.71709
-1.52532
0.451237
-0.433729
0.364148
-0.0369114
-1.06555
-1.10015
0.505855
0.132901
-1.60244
-1.44152
-0.362618
0.61779
0.598584
-0.268544
0.345012
-0.224572
-0.32818
-0.608008
0.304655
-1.58021
-0.957247
-0.153116
0.728037
-0.781638
0.299248
-1.01198
-2.83137
0.798489
0.827847
-0.934652
0.63001
1.03488
1.00077
-0.675237
-0.799248
0.902245
-0.495148
-0.813655
-0.301978
0.754203
-0.539649
-1.24661
0.240017
-0.23316
1.5657
-0.0115331
-0.3167
1.52771
0.650914
-0.802327
0.277586
0.791351
-1.15709
0.542368
0.173141
0.430741
0.0838947
-0.636769
0.747057
-1.23765
-0.262711
0.310194
0.340807
-2.16208
-1.37788
0.187743
0.557627
0.47631
0.144621
-0.319431
-0.47673
0.875779
0.438157
1.4152
0.776824
-2.44252
1.33281
0.365042
0.512594
0.0497653
-0.442708
0.426335
0.812582
-1.07237
0.433274
-1.09235
0.793357
-0.275718
0.818681
0.778238