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:
Marshall Clow
2014-09-17 18:33:58 +00:00
parent 6d9505ad8a
commit 5ffb8d0fbe
2 changed files with 15 additions and 1 deletions

View File

@@ -321,6 +321,17 @@ int main()
assert(std::abs(skew - x_skew) < 0.01);
assert(std::abs((kurtosis - x_kurtosis) / x_kurtosis) < 0.01);
}
{
const int N = 100000;
std::mt19937 gen1;
std::mt19937 gen2;
std::binomial_distribution<> dist1(5, 0.1);
std::binomial_distribution<unsigned> dist2(5, 0.1);
for(int i = 0; i < N; ++i)
assert(dist1(gen1) == dist2(gen2));
}
{
typedef std::binomial_distribution<> D;
typedef std::mt19937 G;