diff options
author | James Moore <jmoore@php.net> | 2001-02-22 00:24:19 +0000 |
---|---|---|
committer | James Moore <jmoore@php.net> | 2001-02-22 00:24:19 +0000 |
commit | 118c015529d69e06b6970bc9185436e60313f31e (patch) | |
tree | 5b58f083918e0f364229be2d4a24e88c42a93192 /ext/standard/crypt.c | |
parent | 6e31987376e066b4fb856c2f619e78bb49222e23 (diff) | |
download | php-git-118c015529d69e06b6970bc9185436e60313f31e.tar.gz |
Adding php_rand() and php_srand(seed) as a wrapper around random, lrand48 and rand.
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r-- | ext/standard/crypt.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 2293b7aed8..269d06ad2a 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -85,13 +85,9 @@ extern char *crypt(char *__key,char *__salt); #define PHP_STD_DES_CRYPT 1 #endif -#if HAVE_RANDOM -#define PHP_CRYPT_RAND random() -#elif HAVE_LRAND48 -#define PHP_CRYPT_RAND lrand48() -#else -#define PHP_CRYPT_RAND rand() -#endif + +#define PHP_CRYPT_RAND php_rand() + PHP_MINIT_FUNCTION(crypt) { @@ -105,13 +101,7 @@ 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_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 + php_srand(time(0) * getpid() * (php_combined_lcg() * 10000.0)); return SUCCESS; } |