#include "stack-c.h"#include <math.h>Include dependency graph for igngeom.c:

Go to the source code of this file.
Functions | |
| double F2C() | logp1 (double *x) |
| double C2F() | ranf () |
| double | igngeom (double p) |
| double igngeom | ( | double | p | ) |
Definition at line 55 of file igngeom.c.
References C2F, F2C(), logp1(), and ranf().
Referenced by RandI().
00056 { 00057 static double p_save = 1.0, ln_1_m_p = 0.0; 00058 double u; 00059 00060 if ( p == 1 ) 00061 return ( 1.0 ); 00062 else if ( p != p_save ) /* => recompute log(1-p) */ 00063 { 00064 p_save = p; u = -p; ln_1_m_p = F2C(logp1)(&u); 00065 }; 00066 00067 u = -C2F(ranf)(); 00068 return ( floor( 1.0 + F2C(logp1)(&u)/ln_1_m_p) ); 00069 }
Here is the call graph for this function:

Here is the caller graph for this function:

| double F2C() logp1 | ( | double * | x | ) |
| double C2F() ranf | ( | ) |
Definition at line 65 of file sci_grand.c.
References current_gen, and gen.
Referenced by igngeom(), and RandI().
00066 { 00067 /* random deviate from U[0,1) */ 00068 return ( (double) gen[current_gen]() * factor[current_gen] ); 00069 }
Here is the caller graph for this function:

1.5.1