diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-06-10 15:40:11 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2015-06-10 15:40:11 +0000 |
commit | c9d9b43d7c5994c470726579f8c471e2a12a44c2 (patch) | |
tree | 763e81b54fdc691905d8fe9ae4850f1f4fa8d184 /src | |
parent | 7bf47d73876e0b730e0eb3e709fae5a109a9ac00 (diff) | |
download | mpfr-c9d9b43d7c5994c470726579f8c471e2a12a44c2.tar.gz |
[src/urandomb.c] Fixed bug which could appear with probability 1/2^32
(32-bit limbs) or 1/2^64 (64-bit limbs).
[tests/trandom.c] Added testcase for 32-bit limbs.
(merged changesets r8762,9550-9551 from the trunk)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/3.1@9552 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r-- | src/urandomb.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/urandomb.c b/src/urandomb.c index c3de8fb75..b913e987e 100644 --- a/src/urandomb.c +++ b/src/urandomb.c @@ -98,6 +98,8 @@ mpfr_urandomb (mpfr_ptr rop, gmp_randstate_t rstate) } if (cnt != 0) mpn_lshift (rp + k, rp, nlimbs, cnt); + else if (k != 0) + mpn_copyi (rp + k, rp, nlimbs); if (k != 0) MPN_ZERO (rp, k); } |