Skip to content

Commit

Permalink
OK
Browse files Browse the repository at this point in the history
  • Loading branch information
AZero13 committed Sep 6, 2022
1 parent c9d93e6 commit e42eb10
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions stl/inc/random
Original file line number Diff line number Diff line change
Expand Up @@ -4140,16 +4140,13 @@ private:
_Ty _Rx0;
_Ty _Rs;
uniform_real<_Ty> _Dist(-1, 1);
for (;;) { // get a point inside unit circle
do { // get a point inside unit circle
_Vx1 = _Dist(_Eng);
_Vx2 = _Dist(_Eng);
_Rs = _Vx1 * _Vx1 + _Vx2 * _Vx2;

// very small _Rs will overflow on pow(_Rx0, -_Ty{4} / _Par0._Nx)
if (_Rs < _Ty{1} && _Rs > _Ty{1e-12}) {
break;
}
}
} while (_Rs >= _Ty{1} || _Rs <= _Ty{1e-12});
_Rx0 = _STD sqrt(_Rs);
return _Vx1 * _STD sqrt(_Par0._Nx * (_STD pow(_Rx0, -_Ty{4} / _Par0._Nx) - _Ty{1}) / _Rs);
}
Expand Down

0 comments on commit e42eb10

Please sign in to comment.