diff options
author | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-14 12:08:44 +0000 |
---|---|---|
committer | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-14 12:08:44 +0000 |
commit | 0491ec33c0dcea14d36bd7164b7aee80be4d6599 (patch) | |
tree | cec02598252a4d5895fa7ca8743d739f297e2be7 /random.c | |
parent | e6c7043f0e3724cc7c15826521e4a078f1d89364 (diff) | |
download | mpfr-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.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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]); |