Public Types | |
| enum | RNGSources { RAW_SEED_SOURCE, PREDEF_SEED_SOURCE, HEURISTIC_SEED_SOURCE } |
Public Member Functions | |
| RNG (const char *name="") | |
| RNG (long seed) | |
| void | init () |
| long | seed () |
| void | set_seed (long seed) |
| long | next () |
| double | next_double () |
| RNG (RNGSources source, int seed=1) | |
| void | set_seed (RNGSources source, int seed=1) |
| void | reset_start_stream () |
| void | reset_start_substream () |
| void | reset_next_substream () |
| void | set_antithetic (bool a) |
| void | increased_precis (bool incp) |
| void | set_seed (const unsigned long seed[6]) |
| void | advance_state (long e, long c) |
| void | get_state (unsigned long seed[6]) const |
| void | write_state () const |
| void | write_state_full () const |
| double | rand_u01 () |
| long | rand_int (long i, long j) |
| int | command (int argc, const char *const *argv) |
| int | uniform_positive_int () |
| double | uniform_double () |
| int | random () |
| double | uniform () |
| int | uniform (int k) |
| double | uniform (double r) |
| double | uniform (double a, double b) |
| double | exponential () |
| double | exponential (double r) |
| double | pareto (double scale, double shape) |
| double | paretoII (double scale, double shape) |
| double | normal (double avg, double std) |
| double | lognormal (double avg, double std) |
| double | rweibull (double shape, double scale) |
| double | qweibull (double p, double shape, double scale) |
| double | logit (double x_) |
| double | logitinv (double x_) |
| double | gammln (double xx) |
| double | pnorm (double q) |
| double | rnorm () |
| int | rbernoulli (double p) |
| double | rgamma (double a, double scale) |
| double | exp_rand () |
Static Public Member Functions | |
| static RNG * | defaultrng () |
| static void | set_package_seed (const unsigned long seed[6]) |
Protected Member Functions | |
| double | U01 () |
| double | U01d () |
Protected Attributes | |
| double | Cg_ [6] |
| double | Bg_ [6] |
| double | Ig_ [6] |
| bool | anti_ |
| bool | inc_prec_ |
| char | name_ [100] |
Static Protected Attributes | |
| static double | next_seed_ [6] |
| static RNG * | default_ = NULL |
| double RNG::exp_rand | ( | void | ) |
q[k-1] = sum(log(2)^k / k!) k=1,..,n, The highest n (here 8) is determined by q[n-1] = 1.0 within standard precision
| double RNG::rgamma | ( | double | a, | |
| double | scale | |||
| ) |
Coefficients q[k] - for q0 = sum(q[k]*a^(-k)) Coefficients a[k] - for q = q0+(t*t/2)*sum(a[k]*v^k) Coefficients e[k] - for exp(q)-1 = sum(e[k]*q^k)
Step 2: t = standard normal deviate, x = (s,1/2) -normal deviate.
Approximation depending on size of parameter a The constants in the expressions for b, si and c were established by numerical experiments
Step 8: e = standard exponential deviate u = 0,1 -uniform deviate t = (b,si)-double exponential (laplace) sample
Step 11: hat acceptance (h) (if q not positive go to step 8)
double RNG::next_seed_ [static, protected] |
{
12345.0, 12345.0, 12345.0, 12345.0, 12345.0, 12345.0
}
1.7.1