From 8e14b499c275d023547460e555e9fbffeeea5c5d Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sat, 26 Apr 2025 16:42:24 +0800 Subject: [PATCH 1/2] Remove one meaningless `_Small_poisson_distribution::_Init` call --- stl/inc/random | 1 - 1 file changed, 1 deletion(-) diff --git a/stl/inc/random b/stl/inc/random index f866dab8eaa..a8bbf77e865 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2979,7 +2979,6 @@ public: _Sqrt = _CSTD sqrt(2 * _Mean * (1 - _Pp)); _Logp = _CSTD log(_Pp); _Logp1 = _CSTD log(1.0 - _Pp); - _Small._Init(_Mean); } _Ty _Tx; From ea30baef55a4d7e2456ae4a0878711f62f45093e Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sat, 26 Apr 2025 23:42:46 +0800 Subject: [PATCH 2/2] Rename `_Init` to `_Init_v2` to avoid potential link-time bugs --- stl/inc/random | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stl/inc/random b/stl/inc/random index a8bbf77e865..9d23e38c537 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -2941,11 +2941,11 @@ public: using distribution_type = binomial_distribution; param_type() noexcept /* strengthened */ { - _Init(1, _Ty1(0.5)); + _Init_v2(1, _Ty1(0.5)); } explicit param_type(_Ty _Tx0, _Ty1 _Px0 = _Ty1(0.5)) noexcept /* strengthened */ { - _Init(_Tx0, _Px0); + _Init_v2(_Tx0, _Px0); } _NODISCARD friend bool operator==(const param_type& _Left, const param_type& _Right) noexcept @@ -2968,7 +2968,7 @@ public: return _Px; } - void _Init(_Ty _Tx0, _Ty1 _Px0) noexcept { // initialize + void _Init_v2(_Ty _Tx0, _Ty1 _Px0) noexcept { // initialize _STL_ASSERT(0.0 <= _Tx0, "invalid max argument for binomial_distribution"); _STL_ASSERT(0.0 <= _Px0 && _Px0 <= 1.0, "invalid probability argument for binomial_distribution"); _Tx = _Tx0; @@ -3057,7 +3057,7 @@ public: binomial_distribution::_Ty1 _Px0; _In(_Istr, _Px0); _In(_Istr, _Tx0); - _Dist._Par._Init(_Tx0, _Px0); + _Dist._Par._Init_v2(_Tx0, _Px0); return _Istr; }