1 /******************************************************************************* 2 This file is part of LibTMCG. 3 4 Copyright (C) 2002, 2004, 2005, 2007, 5 2016, 2017, 2018 Heiko Stamer <HeikoStamer@gmx.net> 6 7 LibTMCG is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 LibTMCG is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with LibTMCG; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 *******************************************************************************/ 21 22 #ifndef INCLUDED_mpz_srandom_HH 23 #define INCLUDED_mpz_srandom_HH 24 25 // C and STL headers 26 #include <cstdlib> 27 28 // GNU multiple precision library 29 #include <gmp.h> 30 31 unsigned long int tmcg_mpz_ssrandom_ui 32 (); 33 unsigned long int tmcg_mpz_srandom_ui 34 (); 35 unsigned long int tmcg_mpz_wrandom_ui 36 (); 37 unsigned long int tmcg_mpz_ssrandom_mod 38 (const unsigned long int modulo); 39 unsigned long int tmcg_mpz_srandom_mod 40 (const unsigned long int modulo); 41 unsigned long int tmcg_mpz_wrandom_mod 42 (const unsigned long int modulo); 43 44 void tmcg_mpz_ssrandomb 45 (mpz_ptr r, const unsigned long int size); 46 void tmcg_mpz_srandomb 47 (mpz_ptr r, const unsigned long int size); 48 void tmcg_mpz_wrandomb 49 (mpz_ptr r, const unsigned long int size); 50 void tmcg_mpz_ssrandomm 51 (mpz_ptr r, mpz_srcptr m); 52 void tmcg_mpz_srandomm 53 (mpz_ptr r, mpz_srcptr m); 54 void tmcg_mpz_wrandomm 55 (mpz_ptr r, mpz_srcptr m); 56 57 void tmcg_mpz_ssrandomm_cache_init 58 (mpz_t ssrandomm_cache[TMCG_MAX_SSRANDOMM_CACHE], 59 mpz_ptr ssrandomm_cache_mod, 60 size_t &ssrandomm_cache_avail, 61 const size_t n, 62 mpz_srcptr m); 63 void tmcg_mpz_ssrandomm_cache 64 (mpz_t ssrandomm_cache[TMCG_MAX_SSRANDOMM_CACHE], 65 mpz_srcptr ssrandomm_cache_mod, 66 size_t &ssrandomm_cache_avail, 67 mpz_ptr r, 68 mpz_srcptr m); 69 void tmcg_mpz_ssrandomm_cache_done 70 (mpz_t ssrandomm_cache[TMCG_MAX_SSRANDOMM_CACHE], 71 mpz_ptr ssrandomm_cache_mod, 72 size_t &ssrandomm_cache_avail); 73 #endif 74 75