diff --git a/stl/inc/random b/stl/inc/random index 32be63fa7df..2acfaa5656b 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -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); }