From 0491ec33c0dcea14d36bd7164b7aee80be4d6599 Mon Sep 17 00:00:00 2001 From: hanrot Date: Thu, 14 Dec 2000 12:08:44 +0000 Subject: Replaced random by rand. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@854 280ebfd0-de03-0410-8827-d642c229c3f4 --- random.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'random.c') diff --git a/random.c b/random.c index d4401cb68..c850ac37d 100644 --- a/random.c +++ b/random.c @@ -52,10 +52,17 @@ mpfr_random(x) for (i = 0; i < xn; i++) { - /* random() c/sh/ould be replaced by a homemade random number generator. + /* rand() c/sh/ould be replaced by a homemade random number generator. Indeed, if on Linux random is a good RNG, this is definitely not the case in most Un*xes. */ - xp[i] = (random() << 1) | (random() & 1); + + xp[i] = 0; + + for (z = 0; z < BITS_PER_MP_LIMB / 15; z++) { + xp[i] |= rand(); xp[i] <<= 15; + } + + xp[i] ^= rand(); } count_leading_zeros(cnt, xp[xn - 1]); -- cgit v1.2.1