~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/gmp/mpz/random.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2007-04-09 11:51:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070409115151-ql8cr0kalzx1jmla
Tags: 0.9i-20070324-2
Upload to unstable. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* mpz_random -- Generate a random mpz_t of specified size in limbs.
2
2
 
3
 
Copyright 2001 Free Software Foundation, Inc.
 
3
Copyright 2001, 2002 Free Software Foundation, Inc.
4
4
 
5
5
This file is part of the GNU MP Library.
6
6
 
16
16
 
17
17
You should have received a copy of the GNU Lesser General Public License
18
18
along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
19
 
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20
 
MA 02111-1307, USA. */
 
19
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
20
MA 02110-1301, USA. */
21
21
 
22
22
#include "gmp.h"
23
23
#include "gmp-impl.h"
25
25
void
26
26
mpz_random (mpz_ptr x, mp_size_t size)
27
27
{
28
 
  mpz_urandomb (x, RANDS, ABS (size) * BITS_PER_MP_LIMB);
 
28
  mpz_urandomb (x, RANDS, (unsigned long) (ABS (size) * GMP_NUMB_BITS));
29
29
  if (size < 0)
30
30
    SIZ(x) = -SIZ(x);
31
31
}