diff options
author | Jim Jagielski <jimjag@php.net> | 2001-02-06 16:27:08 +0000 |
---|---|---|
committer | Jim Jagielski <jimjag@php.net> | 2001-02-06 16:27:08 +0000 |
commit | e541a27eed8d024678e08d69d71c2c76a5e253e2 (patch) | |
tree | dafc7f3dc4d1b53549daaf8a046afc730144023a /ext/standard/crypt.c | |
parent | 222ac6e30eae7c9c072a7fbc2bf57a83eaac83d0 (diff) | |
download | php-git-e541a27eed8d024678e08d69d71c2c76a5e253e2.tar.gz |
For those lucky systems with both random() and *rand48(), the random()
family is the prefered choice. So if both exist, we now choose that.
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r-- | ext/standard/crypt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index d4cc55b43c..2293b7aed8 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -85,10 +85,10 @@ extern char *crypt(char *__key,char *__salt); #define PHP_STD_DES_CRYPT 1 #endif -#if HAVE_LRAND48 -#define PHP_CRYPT_RAND lrand48() -#elif HAVE_RANDOM +#if HAVE_RANDOM #define PHP_CRYPT_RAND random() +#elif HAVE_LRAND48 +#define PHP_CRYPT_RAND lrand48() #else #define PHP_CRYPT_RAND rand() #endif @@ -105,10 +105,10 @@ PHP_MINIT_FUNCTION(crypt) REGISTER_LONG_CONSTANT("CRYPT_MD5", PHP_MD5_CRYPT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CRYPT_BLOWFISH", PHP_BLOWFISH_CRYPT, CONST_CS | CONST_PERSISTENT); -#if HAVE_SRAND48 - srand48((long) time(0) * (long) getpid() * (long) (php_combined_lcg() * 10000.0)); -#elif HAVE_SRANDOM +#if HAVE_SRANDOM srandom((unsigned int) time(0) * getpid() * (php_combined_lcg() * 10000.0)); +#elif HAVE_SRAND48 + srand48((long) time(0) * (long) getpid() * (long) (php_combined_lcg() * 10000.0)); #else srand((unsigned int) time(0) * getpid() * (php_combined_lcg() * 10000.0)); #endif |