File indexing completed on 2026-04-09 07:49:14
0001
0002
0003
0004
0005
0006
0007
0008 #include <iostream>
0009 #include <iomanip>
0010 #include <random>
0011
0012
0013
0014 int main()
0015 {
0016 std::mt19937_64 rng;
0017
0018 unsigned seed = 0u ;
0019 rng.seed(seed);
0020 std::uniform_real_distribution<double> unif(0, 1);
0021
0022 double a ;
0023 double b ;
0024 bool done ;
0025 unsigned count = 0 ;
0026
0027 do {
0028 a = unif(rng);
0029 b = unif(rng);
0030 std::cout
0031 << " count " << std::setw(10) << count
0032 << " a " << std::fixed << std::setw(10) << std::setprecision(4) << a
0033 << " b " << std::fixed << std::setw(10) << std::setprecision(4) << b
0034 << std::endl
0035 ;
0036
0037 done = a > 0.99 && b > 0.99 ;
0038 count += 1 ;
0039
0040 } while( done == false ) ;
0041
0042
0043 std::cout
0044 << " result "
0045 << " count " << count
0046 << " a " << a
0047 << " b " << b
0048 << std::endl
0049 ;
0050
0051 return 0;
0052 }
0053
0054