MCPcopy Create free account
hub / github.com/numpy/numpy / random_poisson_mult

Function random_poisson_mult

numpy/random/src/distributions/distributions.c:540–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540static RAND_INT_TYPE random_poisson_mult(bitgen_t *bitgen_state, double lam) {
541 RAND_INT_TYPE X;
542 double prod, U, enlam;
543
544 enlam = exp(-lam);
545 X = 0;
546 prod = 1.0;
547 while (1) {
548 U = next_double(bitgen_state);
549 prod *= U;
550 if (prod > enlam) {
551 X += 1;
552 } else {
553 return X;
554 }
555 }
556}
557
558/*
559 * The transformed rejection method for generating Poisson random variables

Callers 1

random_poissonFunction · 0.85

Calls 2

expFunction · 0.85
next_doubleFunction · 0.85

Tested by

no test coverage detected