#else
static php_lcg_globals lcg_globals;
#endif
-
#ifdef PHP_WIN32
#include <process.h>
/*
* combinedLCG() returns a pseudo random number in the range of (0, 1).
- * The function combines two CGs with periods of
+ * The function combines two CGs with periods of
* 2^31 - 85 and 2^31 - 249. The period of this function
* is equal to the product of both primes.
*/
static void lcg_seed(TSRMLS_D);
-PHPAPI double php_combined_lcg(TSRMLS_D)
+PHPAPI double php_combined_lcg(TSRMLS_D) /* {{{ */
{
php_int32 q;
php_int32 z;
-
+
if (!LCG(seeded)) {
lcg_seed(TSRMLS_C);
}
return z * 4.656613e-10;
}
+/* }}} */
-static void lcg_seed(TSRMLS_D)
+static void lcg_seed(TSRMLS_D) /* {{{ */
{
struct timeval tv;
LCG(seeded) = 1;
}
+/* }}} */
-static void lcg_init_globals(php_lcg_globals *lcg_globals_p TSRMLS_DC)
+static void lcg_init_globals(php_lcg_globals *lcg_globals_p TSRMLS_DC) /* {{{ */
{
LCG(seeded) = 0;
}
+/* }}} */
-PHP_MINIT_FUNCTION(lcg)
+PHP_MINIT_FUNCTION(lcg) /* {{{ */
{
#ifdef ZTS
ts_allocate_id(&lcg_globals_id, sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL);
#endif
return SUCCESS;
}
+/* }}} */
/* {{{ proto float lcg_value()
Returns a value from the combined linear congruential generator */