diff options
Diffstat (limited to 'ext/standard/rand.c')
-rw-r--r-- | ext/standard/rand.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 528b38fd41..c725514413 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -109,7 +109,7 @@ PHPAPI zend_long php_rand(void) Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, Copyright (C) 2000 - 2003, Richard J. Wagner - All rights reserved. + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -122,8 +122,8 @@ PHPAPI zend_long php_rand(void) notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -209,14 +209,14 @@ PHPAPI php_uint32 php_mt_rand(void) { /* Pull a 32-bit integer from the generator state Every other access function simply transforms the numbers extracted here */ - + register php_uint32 s1; if (BG(left) == 0) { php_mt_reload(); } --BG(left); - + s1 = *BG(next)++; s1 ^= (s1 >> 11); s1 ^= (s1 << 7) & 0x9d2c5680U; @@ -247,7 +247,7 @@ PHP_FUNCTION(mt_srand) { zend_long seed = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &seed) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &seed) == FAILURE) return; if (ZEND_NUM_ARGS() == 0) @@ -279,10 +279,10 @@ PHP_FUNCTION(mt_srand) # number of b+1 which would be bad. So we bump M up by one to make sure # this will never happen, and the final algorithm looks like this: # - # n' = a + n(b-a+1)/(M+1) + # n' = a + n(b-a+1)/(M+1) * * -RL - */ + */ /* {{{ proto int rand([int min, int max]) Returns a random number */ @@ -331,8 +331,8 @@ PHP_FUNCTION(mt_rand) * Melo: hmms.. randomMT() returns 32 random bits... * Yet, the previous php_rand only returns 31 at most. * So I put a right shift to loose the lsb. It *seems* - * better than clearing the msb. - * Update: + * better than clearing the msb. + * Update: * I talked with Cokus via email and it won't ruin the algorithm */ number = (zend_long) (php_mt_rand() >> 1); |