diff options
author | Kevin Ryde <user42@zip.com.au> | 2002-09-18 00:46:56 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2002-09-18 00:46:56 +0200 |
commit | 0090a36345580fadf2b0c9f3319d91433779cf5b (patch) | |
tree | ca10b4339e3b83914b75787b97839e553a3eb36f /mpz/urandomm.c | |
parent | 0b7bfa3267950a70cfad0eac2eacc89888d03e3b (diff) | |
download | gmp-0090a36345580fadf2b0c9f3319d91433779cf5b.tar.gz |
Less of:
2002-09-10 Pedro Gimeno <pggimeno@wanadoo.es>
* mpz/urandomm.c: Use mpn level functions, avoid an infinite loop if
_gmp_rand forever returns all "1" bits.
Only return positive results, ie. use the absolute value of the modulus.
Diffstat (limited to 'mpz/urandomm.c')
-rw-r--r-- | mpz/urandomm.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mpz/urandomm.c b/mpz/urandomm.c index 0697fdffd..6d2ea9435 100644 --- a/mpz/urandomm.c +++ b/mpz/urandomm.c @@ -76,6 +76,5 @@ mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n) mpn_sub_n (rp, rp, PTR (n), size); MPN_NORMALIZE (rp, size); - /* Set rop's size and sign. */ - SIZ (rop) = (SIZ (n) >= 0) ? size : -size; + SIZ (rop) = size; } |