-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathrandtest.c
53 lines (45 loc) · 1.42 KB
/
randtest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
Copyright (C) 2012 Fredrik Johansson
This file is part of Arb.
Arb is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include "acb.h"
void
acb_randtest(acb_t z, flint_rand_t state, slong prec, slong mag_bits)
{
arb_randtest(acb_realref(z), state, prec, mag_bits);
arb_randtest(acb_imagref(z), state, prec, mag_bits);
}
void
acb_randtest_special(acb_t z, flint_rand_t state, slong prec, slong mag_bits)
{
arb_randtest_special(acb_realref(z), state, prec, mag_bits);
arb_randtest_special(acb_imagref(z), state, prec, mag_bits);
}
void
acb_randtest_precise(acb_t z, flint_rand_t state, slong prec, slong mag_bits)
{
arb_randtest_precise(acb_realref(z), state, prec, mag_bits);
arb_randtest_precise(acb_imagref(z), state, prec, mag_bits);
}
void
acb_randtest_param(acb_t x, flint_rand_t state, slong prec, slong size)
{
if (n_randint(state, 8) == 0)
{
fmpz_t t;
fmpz_init(t);
fmpz_randtest(t, state, 1 + n_randint(state, prec));
arb_set_fmpz(acb_realref(x), t);
arb_zero(acb_imagref(x));
acb_mul_2exp_si(x, x, -1);
fmpz_clear(t);
}
else
{
acb_randtest(x, state, prec, size);
}
}