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

Function random_hypergeometric

numpy/random/src/distributions/random_hypergeometric.c:246–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244 */
245
246int64_t random_hypergeometric(bitgen_t *bitgen_state,
247 int64_t good, int64_t bad, int64_t sample)
248{
249 int64_t r;
250
251 if ((sample >= 10) && (sample <= good + bad - 10)) {
252 // This will use the ratio-of-uniforms method.
253 r = hypergeometric_hrua(bitgen_state, good, bad, sample);
254 }
255 else {
256 // The simpler implementation is faster for small samples.
257 r = hypergeometric_sample(bitgen_state, good, bad, sample);
258 }
259 return r;
260}

Calls 2

hypergeometric_hruaFunction · 0.85
hypergeometric_sampleFunction · 0.85

Tested by

no test coverage detected