summaryrefslogtreecommitdiff
path: root/rand.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>1999-05-26 23:04:27 +0200
committerLinus Nordberg <linus@nordberg.se>1999-05-26 23:04:27 +0200
commit02707f71e17c66ad759238391ca01fba206bbea9 (patch)
tree36063f3939e16f4f7f7751fc943f8eabac033533 /rand.c
parent2e020eb17385e486801af0d516ce794cdff1f234 (diff)
downloadgmp-02707f71e17c66ad759238391ca01fba206bbea9.tar.gz
Improve mpn_rawrandom(). It almost works now.
Diffstat (limited to 'rand.c')
-rw-r--r--rand.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/rand.c b/rand.c
index 91be98982..79f930888 100644
--- a/rand.c
+++ b/rand.c
@@ -29,23 +29,13 @@ MA 02111-1307, USA. */
containing all zeros. */
static __gmp_rand_lc_scheme_struct __gmp_rand_scheme[] =
{
- /* FIXME: For reference only. Remove. */
- {31, /* Knuth, p. 185 */
- "48271",
- 0, /* c = 0 */
- "0x7fffffff",}, /* m = 2^31 - 1 */
-
- /* FIXME: For reference only. Remove. */
- {31, /* fbsd random(3), lazy */
- "16807", /* a = 7^5 */
- 0, /* c = 0 */
- "0x7fffffff"}, /* m = 2^31 - 1 */
-
- /* FIXME: For reference only. Remove. */
+ /* FIXME: Testing. Remove. */
+ {8, "7", 0, "256"},
+
{31, /* fbsd rand(3) */
"1103515245", /* a (multiplier) */
12345, /* c (adder) */
- "0x80000000"}, /* m (modulo) = 2^31 */
+ "0x80000000"}, /* m (modulo) = 2^31 */
/* The multipliers are all between 0.01m and 0.99m, and are
congruent to 5 (mod 8). */
@@ -81,8 +71,7 @@ static __gmp_rand_lc_scheme_struct __gmp_rand_scheme[] =
{256, "1157920892373161954235709850086879078532699846656405640394575840079131296413", /* working: moufang */
1, "0x10000000000000000000000000000000000000000000000000000000000000000"},
- /* {, "", 1, "0x"}, */
- {0, NULL, 0, NULL} /* End of array. */
+ {0, NULL, 0, NULL} /* End of array. */
};
/* gmp_rand_init() -- Initialize a gmp_rand_state. Return 0 on
@@ -161,7 +150,7 @@ gmp_rand_init (s, alg, size, seed)
s->alg = alg;
s->size = size;
- mpz_init_set_ui (s->seed, seed);
+ mpz_init_set (s->seed, seed);
mpz_clear (p);
mpz_clear (q);