| 10 | */ |
| 11 | template <typename T, typename TRng> |
| 12 | static inline T StdNormalDistribution(TRng&& rng) noexcept { |
| 13 | T x; |
| 14 | T y; |
| 15 | T r; |
| 16 | |
| 17 | do { |
| 18 | x = (T)rng.GenRandReal1() * T(2) - T(1); |
| 19 | y = (T)rng.GenRandReal1() * T(2) - T(1); |
| 20 | r = x * x + y * y; |
| 21 | } while (r > T(1) || r <= T(0)); |
| 22 | |
| 23 | return x * std::sqrt(-T(2) * std::log(r) / r); |
| 24 | } |
| 25 | |
| 26 | template <typename T, typename TRng> |
| 27 | static inline T NormalDistribution(TRng&& rng, T m, T d) noexcept { |
nothing calls this directly
no test coverage detected