summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>2000-12-14 12:08:44 +0000
committerhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>2000-12-14 12:08:44 +0000
commit0491ec33c0dcea14d36bd7164b7aee80be4d6599 (patch)
treecec02598252a4d5895fa7ca8743d739f297e2be7 /random.c
parente6c7043f0e3724cc7c15826521e4a078f1d89364 (diff)
downloadmpfr-0491ec33c0dcea14d36bd7164b7aee80be4d6599.tar.gz
Replaced random by rand.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@854 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'random.c')
-rw-r--r--random.c11
1 files changed, 9 insertions, 2 deletions
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]);