Fix PR#20843: binomial_distribution<unsigned> is broken. Add test to ensure that signed and unsigned verstions produce the same sequence.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4009,6 +4009,8 @@ binomial_distribution<_IntType>::param_type::param_type(result_type __t, double
|
||||
}
|
||||
}
|
||||
|
||||
// Reference: Kemp, C.D. (1986). `A modal method for generating binomial
|
||||
// variables', Commun. Statist. - Theor. Meth. 15(3), 805-813.
|
||||
template<class _IntType>
|
||||
template<class _URNG>
|
||||
_IntType
|
||||
@@ -4035,7 +4037,8 @@ binomial_distribution<_IntType>::operator()(_URNG& __g, const param_type& __pr)
|
||||
if (__u < 0)
|
||||
return __rd - 1;
|
||||
}
|
||||
--__rd;
|
||||
if ( __rd != 0 )
|
||||
--__rd;
|
||||
++__ru;
|
||||
if (__ru <= __pr.__t_)
|
||||
{
|
||||
|
Reference in New Issue
Block a user