Fix normal_distribution bug

This commit is contained in:
Nikita Lisitsa 2021-01-23 21:33:45 +03:00
parent 5e7aa7601d
commit 7ac4e3eb9b

View file

@ -56,7 +56,9 @@ namespace psemek::random
}
uniform_real_distribution<T> d;
T const u1 = d(rng);
T u1 = 0.f;
while (u1 == 0.f)
u1 = d(rng);
T const u2 = d(rng);
T const r = std::sqrt(- 2 * std::log(u1));