version 1.1, 2000/09/09 14:12:16 |
version 1.1.1.2, 2003/08/25 16:06:00 |
|
|
linear congruential generator with multiplier A, adder C, and |
linear congruential generator with multiplier A, adder C, and |
modulus M. |
modulus M. |
|
|
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright 1999, 2000 Free Software Foundation, Inc. |
|
|
This file is part of the GNU MP Library. |
This file is part of the GNU MP Library. |
|
|
Line 25 MA 02111-1307, USA. */ |
|
Line 25 MA 02111-1307, USA. */ |
|
#include "gmp-impl.h" |
#include "gmp-impl.h" |
|
|
void |
void |
#if __STDC__ |
|
gmp_randinit_lc (gmp_randstate_t rstate, |
gmp_randinit_lc (gmp_randstate_t rstate, |
mpz_t a, |
mpz_srcptr a, |
unsigned long int c, |
unsigned long int c, |
mpz_t m) |
mpz_srcptr m) |
#else |
|
gmp_randinit_lc (rstate, a, c, m) |
|
gmp_randstate_t rstate; |
|
mpz_t a; |
|
unsigned long int c; |
|
mpz_t m; |
|
#endif |
|
{ |
{ |
/* FIXME: Not finished. We don't handle this in _gmp_rand() yet. */ |
/* FIXME: Not finished. We don't handle this in _gmp_rand() yet. */ |
abort (); |
abort (); |
|
|
mpz_init_set_ui (rstate->seed, 1); |
mpz_init_set_ui (rstate->_mp_seed, 1); |
_mpz_realloc (rstate->seed, ABSIZ (m)); |
_mpz_realloc (rstate->_mp_seed, ABSIZ (m)); |
|
|
/* Allocate algorithm specific data. */ |
/* Allocate algorithm specific data. */ |
rstate->algdata.lc = (__gmp_randata_lc *) |
rstate->_mp_algdata._mp_lc = (__gmp_randata_lc *) |
(*_mp_allocate_func) (sizeof (__gmp_randata_lc)); |
(*__gmp_allocate_func) (sizeof (__gmp_randata_lc)); |
|
|
mpz_init_set (rstate->algdata.lc->a, a); |
mpz_init_set (rstate->_mp_algdata._mp_lc->_mp_a, a); |
rstate->algdata.lc->c = c; |
rstate->_mp_algdata._mp_lc->_mp_c = c; |
mpz_init_set (rstate->algdata.lc->m, m); |
mpz_init_set (rstate->_mp_algdata._mp_lc->_mp_m, m); |
|
|
rstate->alg = GMP_RAND_ALG_LC; |
rstate->_mp_alg = GMP_RAND_ALG_LC; |
} |
} |