summaryrefslogtreecommitdiff
path: root/mpf/random2.c
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2001-01-03 00:55:54 +0100
committertege <tege@gmplib.org>2001-01-03 00:55:54 +0100
commit18a050bfd581124c9718d49f2db2c86ee202f149 (patch)
treeb3c6d547feb606b57bffa148485fa9e9a0063420 /mpf/random2.c
parentc4767b8f84b753a01f30a2fa3b4be3a1ad85c8e8 (diff)
downloadgmp-18a050bfd581124c9718d49f2db2c86ee202f149.tar.gz
(myrandom): New function.
(mpf_random2): Use it.
Diffstat (limited to 'mpf/random2.c')
-rw-r--r--mpf/random2.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/mpf/random2.c b/mpf/random2.c
index 352f10ed9..d46474f3b 100644
--- a/mpf/random2.c
+++ b/mpf/random2.c
@@ -21,7 +21,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-#include <stdlib.h>
+#include <stdlib.h> /* for random(), mrand48() */
#include "gmp.h"
#include "gmp-impl.h"
@@ -29,11 +29,16 @@ MA 02111-1307, USA. */
#if defined (__hpux) || defined (__alpha) || defined (__svr4__) || defined (__SVR4)
/* HPUX lacks random(). DEC OSF/1 1.2 random() returns a double. */
static inline long
-random ()
+myrandom ()
{
return mrand48 ();
}
#else
+static inline long
+myrandom ()
+{
+ return random ();
+}
#endif
void
@@ -52,7 +57,7 @@ mpf_random2 (mpf_ptr x, mp_size_t size, mp_exp_t exp)
}
if (exp != 0)
- exp = random () % (2 * exp) - exp;
+ exp = myrandom () % (2 * exp) - exp;
x->_mp_exp = asize == 0 ? 0 : exp;
x->_mp_size = size < 0 ? -asize : asize;
}