3 Copyright 2011, 2013, Free Software Foundation, Inc.
5 This file is part of the GNU MP Library test suite.
7 The GNU MP Library test suite is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 3 of the License,
10 or (at your option) any later version.
12 The GNU MP Library test suite is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 Public License for more details.
17 You should have received a copy of the GNU General Public License along with
18 the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
23 #include "mini-random.h"
26 set_str (mpz_t r, const char *s)
28 if (mpz_set_str (r, s, 16) != 0)
30 fprintf (stderr, "mpz_set_str failed on input %s\n", s);
36 mini_urandomb (mpz_t r, unsigned long bits)
39 s = hex_urandomb (bits);
45 mini_rrandomb (mpz_t r, unsigned long bits)
48 s = hex_rrandomb (bits);
54 mini_rrandomb_export (mpz_t r, void *dst, size_t *countp,
55 int order, size_t size, int endian, unsigned long bits)
58 s = hex_rrandomb_export (dst, countp, order, size, endian, bits);
64 mini_random_op2 (enum hex_random_op op, unsigned long maxbits,
70 hex_random_op2 (op, maxbits, &ap, &rp);
79 mini_random_op3 (enum hex_random_op op, unsigned long maxbits,
80 mpz_t a, mpz_t b, mpz_t r)
86 hex_random_op3 (op, maxbits, &ap, &bp, &rp);
97 mini_random_op4 (enum hex_random_op op, unsigned long maxbits,
98 mpz_t a, mpz_t b, mpz_t c, mpz_t d)
105 hex_random_op4 (op, maxbits, &ap, &bp, &cp, &dp);
118 mini_random_bit_op (enum hex_random_op op, unsigned long maxbits,
119 mpz_t a, mp_bitcnt_t *b, mpz_t r)
124 hex_random_bit_op (op, maxbits, &ap, b, &rp);
133 mini_random_scan_op (enum hex_random_op op, unsigned long maxbits,
134 mpz_t a, mp_bitcnt_t *b, mp_bitcnt_t *r)
138 hex_random_scan_op (op, maxbits, &ap, b, r);