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

Function buffered_bounded_bool

numpy/random/src/distributions/distributions.c:1173–1187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1171}
1172
1173static inline npy_bool buffered_bounded_bool(bitgen_t *bitgen_state,
1174 npy_bool off, npy_bool rng,
1175 npy_bool mask, int *bcnt,
1176 uint32_t *buf) {
1177 if (rng == 0)
1178 return off;
1179 if (!(bcnt[0])) {
1180 buf[0] = next_uint32(bitgen_state);
1181 bcnt[0] = 31;
1182 } else {
1183 buf[0] >>= 1;
1184 bcnt[0] -= 1;
1185 }
1186 return (buf[0] & 0x00000001UL) != 0;
1187}
1188
1189/* Static `Lemire rejection` function called by random_bounded_uint64(...) */
1190static inline uint64_t bounded_lemire_uint64(bitgen_t *bitgen_state,

Callers 2

random_bounded_bool_fillFunction · 0.85

Calls 1

next_uint32Function · 0.85

Tested by

no test coverage detected