From 2e46c7c6b3dda2fbff007e47070a47e903cbb1f6 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 27 Jul 1994 17:40:29 +0000 Subject: [PATCH] (random, srandom): Obey HAVE_RAND48 flag. Test that random is not a macro. Don't test USG or BSD4_1. --- src/sysdep.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/sysdep.c b/src/sysdep.c index 828ec00f619..c6a3b4f7a82 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2597,7 +2597,8 @@ bcmp (b1, b2, length) /* This could be a macro! */ #endif /* not BSTRING */ #ifndef HAVE_RANDOM -#ifdef USG +#ifndef random + /* * The BSD random returns numbers in the range of * 0 to 2e31 - 1. The USG rand returns numbers in the @@ -2608,32 +2609,26 @@ bcmp (b1, b2, length) /* This could be a macro! */ long random () { +#ifdef HAVE_RAND48 + return rand48 (); +#else /* Arrange to return a range centered on zero. */ return (rand () << 15) + rand () - (1 << 29); +#endif } srandom (arg) int arg; { +#ifdef HAVE_RAND48 + return srand48 (); +#else srand (arg); +#endif } -#endif /* USG */ - -#ifdef BSD4_1 -long random () -{ - /* Arrange to return a range centered on zero. */ - return (rand () << 15) + rand () - (1 << 29); -} - -srandom (arg) - int arg; -{ - srand (arg); -} -#endif /* BSD4_1 */ -#endif +#endif /* no random */ +#endif /* not HAVE_RANDOM */ #ifdef WRONG_NAME_INSQUE -- 2.39.5