Back to index

php5  5.3.10
Classes | Defines | Functions
php_lcg.h File Reference
#include "ext/standard/basic_functions.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  php_lcg_globals

Defines

#define LCG(v)   (lcg_globals.v)

Functions

PHPAPI double php_combined_lcg (TSRMLS_D)
 PHP_FUNCTION (lcg_value)
 PHP_MINIT_FUNCTION (lcg)

Class Documentation

struct php_lcg_globals

Definition at line 26 of file php_lcg.h.

Class Members
php_int32 s1
php_int32 s2
int seeded

Define Documentation

#define LCG (   v)    (lcg_globals.v)

Definition at line 40 of file php_lcg.h.


Function Documentation

Definition at line 55 of file lcg.c.

{
       php_int32 q;
       php_int32 z;

       if (!LCG(seeded)) {
              lcg_seed(TSRMLS_C);
       }

       MODMULT(53668, 40014, 12211, 2147483563L, LCG(s1));
       MODMULT(52774, 40692, 3791, 2147483399L, LCG(s2));

       z = LCG(s1) - LCG(s2);
       if (z < 1) {
              z += 2147483562;
       }

       return z * 4.656613e-10;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PHP_FUNCTION ( lcg_value  )

Definition at line 119 of file lcg.c.

Here is the call graph for this function:

PHP_MINIT_FUNCTION ( lcg  )

Definition at line 106 of file lcg.c.

{
#ifdef ZTS
       ts_allocate_id(&lcg_globals_id, sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL);
#else
       lcg_init_globals(&lcg_globals);
#endif
       return SUCCESS;
}

Here is the call graph for this function: