summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/mpf_compat.h2
-rw-r--r--tests/mpfr-test.h1
-rw-r--r--tests/random2.c147
-rw-r--r--tests/tadd.c2
-rw-r--r--tests/tadd_d.c2
-rw-r--r--tests/tadd_ui.c2
-rw-r--r--tests/td_div.c2
-rw-r--r--tests/td_sub.c2
-rw-r--r--tests/tdiv.c2
-rw-r--r--tests/tdiv_d.c2
-rw-r--r--tests/tdiv_ui.c2
-rw-r--r--tests/tgamma.c2
-rw-r--r--tests/tj0.c2
-rw-r--r--tests/tj1.c2
-rw-r--r--tests/tmul.c2
-rw-r--r--tests/tmul_d.c2
-rw-r--r--tests/tmul_ui.c2
-rw-r--r--tests/tpow.c4
-rw-r--r--tests/trandom.c153
-rw-r--r--tests/tsi_op.c8
-rw-r--r--tests/tsub.c2
-rw-r--r--tests/tsub_d.c2
-rw-r--r--tests/tsub_ui.c2
-rw-r--r--tests/ty0.c2
-rw-r--r--tests/ty1.c2
26 files changed, 175 insertions, 180 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2619f478f..ab11d8e76 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,7 +27,7 @@ INCLUDES = -I$(top_srcdir) -I$(top_builddir)
LOADLIBES=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(top_builddir)/tests/.libs/libfrtests.a $(top_builddir)/.libs/libmpfr.a $(LIBS) $(MPFR_LIBM)
check_LTLIBRARIES = libfrtests.la
-libfrtests_la_SOURCES = mpfr-test.h memory.c rnd_mode.c tests.c cmp_str.c
+libfrtests_la_SOURCES = mpfr-test.h memory.c rnd_mode.c tests.c cmp_str.c random2.c
$(top_builddir)/libmpfr.la:
cd $(top_builddir); make libmpfr.la
diff --git a/tests/mpf_compat.h b/tests/mpf_compat.h
index 0c05b086c..a390ca37c 100644
--- a/tests/mpf_compat.h
+++ b/tests/mpf_compat.h
@@ -211,8 +211,6 @@ main ()
mpf_urandomb (x, state, 10);
gmp_randclear (state);
- mpf_random2 (x, 17, 17);
-
/* Conversion to mpz */
mpz_init (z);
mpf_set_ui (x, 17);
diff --git a/tests/mpfr-test.h b/tests/mpfr-test.h
index e01804368..10a9954d9 100644
--- a/tests/mpfr-test.h
+++ b/tests/mpfr-test.h
@@ -72,6 +72,7 @@ int mpfr_set_machine_rnd_mode _MPFR_PROTO ((mp_rnd_t));
void mpfr_test_init _MPFR_PROTO ((void));
mp_limb_t randlimb _MPFR_PROTO ((void));
void randseed _MPFR_PROTO ((unsigned int));
+void mpfr_random2 _MPFR_PROTO ((mpfr_ptr, mp_size_t, mp_exp_t, gmp_randstate_t));
int ulp _MPFR_PROTO ((double, double));
double dbl _MPFR_PROTO ((double, int));
double Ulp _MPFR_PROTO ((double));
diff --git a/tests/random2.c b/tests/random2.c
new file mode 100644
index 000000000..66739e862
--- /dev/null
+++ b/tests/random2.c
@@ -0,0 +1,147 @@
+/* mpfr_random2 -- Generate a positive random mpfr_t of specified size, with
+ long runs of consecutive ones and zeros in the binary representation.
+
+Copyright 1999, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+Contributed by the Arenaire and Cacao projects, INRIA.
+
+This file is part of the GNU MPFR Library.
+
+The GNU MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
+http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#define MPFR_NEED_LONGLONG_H
+#include "mpfr-impl.h"
+
+#define LOGBITS_PER_BLOCK 4
+#if GMP_NUMB_BITS < 32
+#define BITS_PER_RANDCALL GMP_NUMB_BITS
+#else
+#define BITS_PER_RANDCALL 32
+#endif
+
+void
+mpfr_random2 (mpfr_ptr x, mp_size_t size, mp_exp_t exp,
+ gmp_randstate_t rstate)
+{
+ mp_size_t xn, k, ri;
+ unsigned long sh;
+ mp_ptr xp;
+ mp_limb_t elimb, ran, acc;
+ int ran_nbits, bit_pos, nb;
+
+ MPFR_CLEAR_FLAGS (x);
+
+ if (MPFR_UNLIKELY(size == 0))
+ {
+ MPFR_SET_ZERO (x);
+ MPFR_SET_POS (x);
+ return ;
+ }
+ else if (size > 0)
+ {
+ MPFR_SET_POS (x);
+ }
+ else
+ {
+ MPFR_SET_NEG (x);
+ size = -size;
+ }
+
+ xn = MPFR_LIMB_SIZE (x);
+ xp = MPFR_MANT (x);
+ if (size > xn)
+ size = xn;
+ k = xn - size;
+
+ /* Code extracted from GMP, function mpn_random2, to avoid the use
+ of GMP's internal random state in MPFR */
+
+ _gmp_rand (&elimb, rstate, BITS_PER_RANDCALL);
+ ran = elimb;
+
+ /* Start off at a random bit position in the most significant limb. */
+ bit_pos = GMP_NUMB_BITS - 1;
+ ran >>= 6; /* Ideally log2(GMP_NUMB_BITS) */
+ ran_nbits = BITS_PER_RANDCALL - 6; /* Ideally - log2(GMP_NUMB_BITS) */
+
+ /* Bit 0 of ran chooses string of ones/string of zeroes.
+ Make most significant limb be non-zero by setting bit 0 of RAN. */
+ ran |= 1;
+ ri = xn - 1;
+
+ acc = 0;
+ while (ri >= k)
+ {
+ if (ran_nbits < LOGBITS_PER_BLOCK + 1)
+ {
+ _gmp_rand (&elimb, rstate, BITS_PER_RANDCALL);
+ ran = elimb;
+ ran_nbits = BITS_PER_RANDCALL;
+ }
+
+ nb = (ran >> 1) % (1 << LOGBITS_PER_BLOCK) + 1;
+ if ((ran & 1) != 0)
+ {
+ /* Generate a string of nb ones. */
+ if (nb > bit_pos)
+ {
+ xp[ri--] = acc | (((mp_limb_t) 2 << bit_pos) - 1);
+ bit_pos += GMP_NUMB_BITS;
+ bit_pos -= nb;
+ acc = ((~(mp_limb_t) 1) << bit_pos) & GMP_NUMB_MASK;
+ }
+ else
+ {
+ bit_pos -= nb;
+ acc |= (((mp_limb_t) 2 << nb) - 2) << bit_pos;
+ }
+ }
+ else
+ {
+ /* Generate a string of nb zeroes. */
+ if (nb > bit_pos)
+ {
+ xp[ri--] = acc;
+ acc = 0;
+ bit_pos += GMP_NUMB_BITS;
+ }
+ bit_pos -= nb;
+ }
+ ran_nbits -= LOGBITS_PER_BLOCK + 1;
+ ran >>= LOGBITS_PER_BLOCK + 1;
+ }
+
+ /* Set mandatory most significant bit. */
+ /* xp[xn - 1] |= MPFR_LIMB_HIGHBIT; */
+
+ if (k != 0)
+ {
+ /* Clear last limbs */
+ MPN_ZERO (xp, k);
+ }
+ else
+ {
+ /* Mask off non significant bits in the low limb. */
+ MPFR_UNSIGNED_MINUS_MODULO (sh, MPFR_PREC (x));
+ xp[0] &= ~MPFR_LIMB_MASK (sh);
+ }
+
+ /* Generate random exponent. */
+ _gmp_rand (&elimb, RANDS, BITS_PER_MP_LIMB);
+ exp = ABS (exp);
+ MPFR_SET_EXP (x, elimb % (2 * exp + 1) - exp);
+
+ return ;
+}
diff --git a/tests/tadd.c b/tests/tadd.c
index 2067e175a..306f20aa4 100644
--- a/tests/tadd.c
+++ b/tests/tadd.c
@@ -1107,7 +1107,7 @@ tests (void)
#define TEST_FUNCTION test_add
#define TWO_ARGS
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tadd_d.c b/tests/tadd_d.c
index 26e4dc61e..6f5b51894 100644
--- a/tests/tadd_d.c
+++ b/tests/tadd_d.c
@@ -130,7 +130,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_add_d
#define DOUBLE_ARG2
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c
index 28fafa906..8c2428c45 100644
--- a/tests/tadd_ui.c
+++ b/tests/tadd_ui.c
@@ -90,7 +90,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_add_ui
#define INTEGER_TYPE unsigned long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric_ui.c"
int
diff --git a/tests/td_div.c b/tests/td_div.c
index f4c605992..3e671418e 100644
--- a/tests/td_div.c
+++ b/tests/td_div.c
@@ -78,7 +78,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_d_sub
#define DOUBLE_ARG1
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/td_sub.c b/tests/td_sub.c
index ab0abd4a3..c9dc9f9c3 100644
--- a/tests/td_sub.c
+++ b/tests/td_sub.c
@@ -69,7 +69,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_d_sub
#define DOUBLE_ARG1
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 043b214d2..5d201345d 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -898,7 +898,7 @@ test_20070628 (void)
#define TEST_FUNCTION test_div
#define TWO_ARGS
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tdiv_d.c b/tests/tdiv_d.c
index c913172f2..125fbe23e 100644
--- a/tests/tdiv_d.c
+++ b/tests/tdiv_d.c
@@ -77,7 +77,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_sub_d
#define DOUBLE_ARG2
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c
index 6b52e7f9b..d86324901 100644
--- a/tests/tdiv_ui.c
+++ b/tests/tdiv_ui.c
@@ -198,7 +198,7 @@ check_inexact (void)
#define TEST_FUNCTION mpfr_div_ui
#define INTEGER_TYPE unsigned long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric_ui.c"
int
diff --git a/tests/tgamma.c b/tests/tgamma.c
index 54ee2e675..b2730a18f 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_gamma
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric.c"
static void
diff --git a/tests/tj0.c b/tests/tj0.c
index 28d6bd6d7..01ccf85ce 100644
--- a/tests/tj0.c
+++ b/tests/tj0.c
@@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_j0
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
#include "tgeneric.c"
diff --git a/tests/tj1.c b/tests/tj1.c
index 4fe0b4bf9..6e3726ed4 100644
--- a/tests/tj1.c
+++ b/tests/tj1.c
@@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_j1
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
#define REDUCE_EMAX 262143 /* otherwise arg. reduction is too expensive */
#include "tgeneric.c"
diff --git a/tests/tmul.c b/tests/tmul.c
index 4e3c39c46..2f2e89acd 100644
--- a/tests/tmul.c
+++ b/tests/tmul.c
@@ -617,7 +617,7 @@ check_regression (void)
#define TEST_FUNCTION test_mul
#define TWO_ARGS
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
#include "tgeneric.c"
/* multiplies x by 53-bit approximation of Pi */
diff --git a/tests/tmul_d.c b/tests/tmul_d.c
index 05eb4e0f2..1b12a1b87 100644
--- a/tests/tmul_d.c
+++ b/tests/tmul_d.c
@@ -76,7 +76,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_mul_d
#define DOUBLE_ARG2
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c
index f1a32b4f7..24a5fa194 100644
--- a/tests/tmul_ui.c
+++ b/tests/tmul_ui.c
@@ -77,7 +77,7 @@ check_inexact (mp_prec_t p)
#define TEST_FUNCTION mpfr_mul_ui
#define INTEGER_TYPE unsigned long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric_ui.c"
int
diff --git a/tests/tpow.c b/tests/tpow.c
index 4011e72ca..2591d1a4a 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -62,12 +62,12 @@ test_pow (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
#define TEST_FUNCTION mpfr_pow_ui
#define INTEGER_TYPE unsigned long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric_ui.c"
#define TEST_FUNCTION mpfr_pow_si
#define INTEGER_TYPE long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#define test_generic_ui test_generic_si
#include "tgeneric_ui.c"
diff --git a/tests/trandom.c b/tests/trandom.c
index 14dafc31e..030737ede 100644
--- a/tests/trandom.c
+++ b/tests/trandom.c
@@ -1,4 +1,4 @@
-/* Test file for the various mpfr_random fonctions.
+/* Test file for mpfr_urandomb
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by the Arenaire and Cacao projects, INRIA.
@@ -25,153 +25,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-static void
-test_random (long nbtests, mp_prec_t prec, int verbose)
-{
- mpfr_t x;
- int *tab, size_tab, k;
- double d, av = 0, var = 0, chi2 = 0, th;
-
- size_tab = (nbtests >= 1000 ? nbtests / 50 : 20);
- tab = (int *) calloc (size_tab, sizeof(int));
- if (tab == NULL)
- {
- fprintf (stderr, "trandom: can't allocate memory in test_random\n");
- exit (1);
- }
-
- mpfr_init2(x, prec);
-
- for (k = 0; k < nbtests; k++)
- {
- mpfr_urandomb (x, RANDS);
- d = mpfr_get_d1 (x); av += d; var += d*d;
- tab[(int)(size_tab * d)]++;
- }
-
- mpfr_clear(x);
- if (!verbose)
- {
- free(tab);
- return;
- }
-
- av /= nbtests;
- var = (var / nbtests) - av*av;
-
- th = (double) nbtests / size_tab;
-
- printf("Average = %.5f\nVariance = %.5f\n", av, var);
- printf("Repartition for random. Each integer should be close to %d.\n",
- (int)th);
-
- for (k = 0; k < size_tab; k++)
- {
- chi2 += (tab[k] - th) * (tab[k] - th) / th;
- printf("%d ", tab[k]);
- if (((k+1) & 7) == 0)
- printf("\n");
- }
-
- printf("\nChi2 statistics value (with %d degrees of freedom) : %.5f\n\n",
- size_tab - 1, chi2);
-
- printf("\n");
-
- free(tab);
- return;
-}
-
-static void
-test_random2 (long nbtests, mp_prec_t prec, int verbose)
-{
- mpfr_t x;
- int *tab, size_tab, k, sh, xn;
- double d, av = 0, var = 0, chi2 = 0, th;
-
- size_tab = (nbtests >= 1000 ? nbtests / 50 : 20);
- tab = (int *) calloc (size_tab, sizeof(int));
- if (tab == NULL)
- {
- fprintf (stderr, "trandom: can't allocate memory in test_random2\n");
- exit (1);
- }
-
- mpfr_init2 (x, prec);
- xn = 1 + (prec - 1) / mp_bits_per_limb;
- sh = xn * mp_bits_per_limb - prec;
-
- for (k = 0; k < nbtests; k++)
- {
- mpfr_random2 (x, xn, 0);
- /* check that lower bits are zero */
- if (MPFR_MANT(x)[0] & MPFR_LIMB_MASK(sh))
- {
- printf ("Error: mpfr_random2() returns invalid numbers:\n");
- mpfr_print_binary (x); puts ("");
- exit (1);
- }
-
- /* check that the number is normalized */
- if (! (MPFR_MANT(x)[MPFR_LIMB_SIZE(x) - 1] >> (BITS_PER_MP_LIMB - 1)))
- {
- printf ("Error: mpfr_random2() returns unnormalized numbers:\n");
- mpfr_print_binary (x); puts ("");
- exit (1);
- }
-
- /* check that exponent is in correct range */
- if (mpfr_get_exp (x) != 0)
- {
- printf ("Error: mpfr_random2 (.., .., 0) does not return"
- " a 0 exponent:\n");
- mpfr_print_binary (x); puts ("");
- exit (1);
- }
- d = mpfr_get_d1 (x); av += d; var += d*d;
- if (d < 1)
- tab[(int)(size_tab * d)]++;
- }
-
- /* test size=0 */
- mpfr_random2 (x, 0, 0);
- MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
- mpfr_set_si (x, -1, MPFR_RNDN); /* x is negative */
- mpfr_random2 (x, 0, 0);
- MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x));
-
- /* test size < 0 */
- mpfr_random2 (x, -1, 0);
- MPFR_ASSERTN (MPFR_IS_NEG (x) && MPFR_EXP (x) == 0);
-
- mpfr_clear (x);
- if (!verbose)
- {
- free(tab);
- return;
- }
-
- av /= nbtests;
- var = (var / nbtests) - av*av;
-
- th = (double)nbtests / size_tab;
- printf("Average = %.5f\nVariance = %.5f\n", av, var);
- printf("Repartition for random2 (taking only values < 1 into account.\n");
-
- for (k = 0; k < size_tab; k++)
- {
- chi2 += (tab[k] - th) * (tab[k] - th) / th;
- printf("%d ", tab[k]);
- if (((k+1) & 7) == 0)
- printf("\n");
- }
-
- printf("\nChi2 statistics value (with %d degrees of freedom) : %.5f\n\n",
- size_tab - 1, chi2);
-
- free(tab);
- return;
-}
static void
test_urandomb (long nbtests, mp_prec_t prec, int verbose)
@@ -275,14 +128,10 @@ main (int argc, char *argv[])
else
prec = atol(argv[2]);
- test_random (nbtests, prec, verbose);
- test_random2 (nbtests, prec, verbose);
test_urandomb (nbtests, prec, verbose);
if (argc == 1) /* check also small precision */
{
- test_random (nbtests, 2, 0);
- test_random2 (nbtests, 2, 0);
test_urandomb (nbtests, 2, 0);
}
diff --git a/tests/tsi_op.c b/tests/tsi_op.c
index f709b0696..43d8273e2 100644
--- a/tests/tsi_op.c
+++ b/tests/tsi_op.c
@@ -68,28 +68,28 @@ check_invert (void)
#define TEST_FUNCTION mpfr_add_si
#define TEST_FUNCTION_NAME "mpfr_add_si"
#define INTEGER_TYPE long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#define test_generic_ui test_generic_add_si
#include "tgeneric_ui.c"
#define TEST_FUNCTION mpfr_sub_si
#define TEST_FUNCTION_NAME "mpfr_sub_si"
#define INTEGER_TYPE long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#define test_generic_ui test_generic_sub_si
#include "tgeneric_ui.c"
#define TEST_FUNCTION mpfr_mul_si
#define TEST_FUNCTION_NAME "mpfr_mul_si"
#define INTEGER_TYPE long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#define test_generic_ui test_generic_mul_si
#include "tgeneric_ui.c"
#define TEST_FUNCTION mpfr_div_si
#define TEST_FUNCTION_NAME "mpfr_div_si"
#define INTEGER_TYPE long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#define test_generic_ui test_generic_div_si
#include "tgeneric_ui.c"
diff --git a/tests/tsub.c b/tests/tsub.c
index e69feceb6..190a0f6b6 100644
--- a/tests/tsub.c
+++ b/tests/tsub.c
@@ -480,7 +480,7 @@ check_inexact (void)
#define TEST_FUNCTION test_sub
#define TWO_ARGS
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tsub_d.c b/tests/tsub_d.c
index 1366d2ca2..543fb53f7 100644
--- a/tests/tsub_d.c
+++ b/tests/tsub_d.c
@@ -69,7 +69,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_sub_d
#define DOUBLE_ARG2
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/tsub_ui.c b/tests/tsub_ui.c
index 0bd2ee923..6bcdc1978 100644
--- a/tests/tsub_ui.c
+++ b/tests/tsub_ui.c
@@ -117,7 +117,7 @@ check_nans (void)
#define TEST_FUNCTION mpfr_sub_ui
#define INTEGER_TYPE unsigned long
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 1, RANDS)
#include "tgeneric_ui.c"
int
diff --git a/tests/ty0.c b/tests/ty0.c
index f788e0c76..d38712c2a 100644
--- a/tests/ty0.c
+++ b/tests/ty0.c
@@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_y0
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
#include "tgeneric.c"
int
diff --git a/tests/ty1.c b/tests/ty1.c
index f66acbf53..c9d3814e2 100644
--- a/tests/ty1.c
+++ b/tests/ty1.c
@@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_y1
-#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8)
+#define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), 8, RANDS)
#include "tgeneric.c"
int