Fix normal_distribution bug
This commit is contained in:
parent
5e7aa7601d
commit
7ac4e3eb9b
1 changed files with 3 additions and 1 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue