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

Function random_buffered_bounded_uint8

numpy/random/src/distributions/distributions.c:1478–1495  ·  view source on GitHub ↗

* Returns a single random npy_uint8 between off and off + rng * inclusive. The numbers wrap if rng is sufficiently large. */

Source from the content-addressed store, hash-verified

1476 * inclusive. The numbers wrap if rng is sufficiently large.
1477 */
1478uint8_t random_buffered_bounded_uint8(bitgen_t *bitgen_state, uint8_t off,
1479 uint8_t rng, uint8_t mask,
1480 bool use_masked, int *bcnt,
1481 uint32_t *buf) {
1482 if (rng == 0) {
1483 return off;
1484 } else if (rng == 0xFFUL) {
1485 /* Lemire8 doesn't support inclusive rng = 0xFF. */
1486 return off + buffered_uint8(bitgen_state, bcnt, buf);
1487 } else {
1488 if (use_masked) {
1489 return off +
1490 buffered_bounded_masked_uint8(bitgen_state, rng, mask, bcnt, buf);
1491 } else {
1492 return off + buffered_bounded_lemire_uint8(bitgen_state, rng, bcnt, buf);
1493 }
1494 }
1495}
1496
1497npy_bool random_buffered_bounded_bool(bitgen_t *bitgen_state, npy_bool off,
1498 npy_bool rng, npy_bool mask,

Callers

nothing calls this directly

Calls 3

buffered_uint8Function · 0.85

Tested by

no test coverage detected