[Gmp-commit] /var/hg/gmp: Another go at random generation.

mercurial at gmplib.org mercurial at gmplib.org
Fri Jun 1 12:11:16 CEST 2012


details:   /var/hg/gmp/rev/0c9d2b9c1fd9
changeset: 15034:0c9d2b9c1fd9
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Jun 01 12:11:12 2012 +0200
description:
Another go at random generation.

diffstat:

 tests/mpz/t-cong.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 401e1ce4ca2e -r 0c9d2b9c1fd9 tests/mpz/t-cong.c
--- a/tests/mpz/t-cong.c	Fri Jun 01 11:19:37 2012 +0200
+++ b/tests/mpz/t-cong.c	Fri Jun 01 12:11:12 2012 +0200
@@ -138,7 +138,7 @@
   mpz_t   a, c, d, ra, rc;
   int     i;
   int     want;
-  int     reps = 20000;
+  int     reps = 10000;
   mpz_t bs;
   unsigned long size_range, size;
 
@@ -156,18 +156,24 @@
   for (i = 0; i < reps; i++)
     {
       mpz_urandomb (bs, rands, 32);
-      size_range = mpz_get_ui (bs) % 14 + 1; /* 0..16384 bit operands */
+      size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */
 
       mpz_urandomb (bs, rands, size_range);
       size = mpz_get_ui (bs);
       mpz_rrandomb (a, rands, size);
 
+      mpz_urandomb (bs, rands, 32);
+      size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */
+
       mpz_urandomb (bs, rands, size_range);
       size = mpz_get_ui (bs);
       mpz_rrandomb (c, rands, size);
 
       do
 	{
+	  mpz_urandomb (bs, rands, 32);
+	  size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */
+
 	  mpz_urandomb (bs, rands, size_range);
 	  size = mpz_get_ui (bs);
 	  mpz_rrandomb (d, rands, size);


More information about the gmp-commit mailing list