1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * gmpy_random.h                                                           *
3  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4  * Python interface to the GMP or MPIR, MPFR, and MPC multiple precision   *
5  * libraries.                                                              *
6  *                                                                         *
7  * Copyright 2000 - 2009 Alex Martelli                                     *
8  *                                                                         *
9  * Copyright 2008 - 2021 Case Van Horsen                                   *
10  *                                                                         *
11  * This file is part of GMPY2.                                             *
12  *                                                                         *
13  * GMPY2 is free software: you can redistribute it and/or modify it under  *
14  * the terms of the GNU Lesser General Public License as published by the  *
15  * Free Software Foundation, either version 3 of the License, or (at your  *
16  * option) any later version.                                              *
17  *                                                                         *
18  * GMPY2 is distributed in the hope that it will be useful, but WITHOUT    *
19  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or   *
20  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public    *
21  * License for more details.                                               *
22  *                                                                         *
23  * You should have received a copy of the GNU Lesser General Public        *
24  * License along with GMPY2; if not, see <http://www.gnu.org/licenses/>    *
25  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26 
27 #ifndef GMPY_RANDOM_H
28 #define GMPY_RANDOM_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* gmpy_random C API extension header file.
35  *
36  * Provide support random number state.
37  *
38  * Version 2.00, December 2011 (created) casevh
39  *
40  * This file is expected to be included from gmpy.h
41  */
42 
43 static PyTypeObject RandomState_Type;
44 #define RANDOM_STATE(obj) (((RandomState_Object *)(obj))->state)
45 #define RandomState_Check(v) (((PyObject*)v)->ob_type == &RandomState_Type)
46 
47 static RandomState_Object * GMPy_RandomState_New(void);
48 static void                 GMPy_RandomState_Dealloc(RandomState_Object *self);
49 
50 static PyObject * GMPy_RandomState_Repr(RandomState_Object *self);
51 static PyObject * GMPy_RandomState_Factory(PyObject *self, PyObject *args);
52 static PyObject * GMPy_MPZ_urandomb_Function(PyObject *self, PyObject *args);
53 static PyObject * GMPy_MPZ_rrandomb_Function(PyObject *self, PyObject *args);
54 static PyObject * GMPy_MPZ_random_Function(PyObject *self, PyObject *args);
55 static PyObject * GMPy_MPFR_random_Function(PyObject *self, PyObject *args);
56 #if MPFR_VERSION_MAJOR > 3
57 static PyObject * GMPy_MPFR_nrandom_Function(PyObject *self, PyObject *args);
58 #endif
59 static PyObject * GMPy_MPFR_grandom_Function(PyObject *self, PyObject *args);
60 static PyObject * GMPy_MPC_random_Function(PyObject *self, PyObject *args);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 #endif
66