summaryrefslogtreecommitdiff
path: root/ext/standard/lcg.c
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-11-06 10:57:10 (GMT)
committerJani Taskinen <jani@php.net>2007-11-06 10:57:10 (GMT)
commit5262157d498a34119e776993bc45c85b482f958a (patch)
tree8ff0d785368fcdf67087cf8bda722356109bc037 /ext/standard/lcg.c
parent661b7c13e6c8f2717c5ff6ebe940eda646d92f5c (diff)
downloadphp-5262157d498a34119e776993bc45c85b482f958a.tar.gz
MFH: ws + folding tags
Diffstat (limited to 'ext/standard/lcg.c')
-rw-r--r--ext/standard/lcg.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index 62531cf..b2aa244 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -36,7 +36,6 @@ int lcg_globals_id;
#else
static php_lcg_globals lcg_globals;
#endif
-
#ifdef PHP_WIN32
#include <process.h>
@@ -44,7 +43,7 @@ static php_lcg_globals lcg_globals;
/*
* 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.
*/
@@ -53,11 +52,11 @@ static php_lcg_globals lcg_globals;
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);
}
@@ -72,8 +71,9 @@ PHPAPI double php_combined_lcg(TSRMLS_D)
return z * 4.656613e-10;
}
+/* }}} */
-static void lcg_seed(TSRMLS_D)
+static void lcg_seed(TSRMLS_D) /* {{{ */
{
struct timeval tv;
@@ -90,13 +90,15 @@ static void lcg_seed(TSRMLS_D)
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);
@@ -105,6 +107,7 @@ PHP_MINIT_FUNCTION(lcg)
#endif
return SUCCESS;
}
+/* }}} */
/* {{{ proto float lcg_value()
Returns a value from the combined linear congruential generator */