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

Function buffered_uint8

numpy/random/src/distributions/distributions.c:1102–1113  ·  view source on GitHub ↗

Generate 8 bit random numbers using a 32 bit buffer. */

Source from the content-addressed store, hash-verified

1100
1101/* Generate 8 bit random numbers using a 32 bit buffer. */
1102static inline uint8_t buffered_uint8(bitgen_t *bitgen_state, int *bcnt,
1103 uint32_t *buf) {
1104 if (!(bcnt[0])) {
1105 buf[0] = next_uint32(bitgen_state);
1106 bcnt[0] = 3;
1107 } else {
1108 buf[0] >>= 8;
1109 bcnt[0] -= 1;
1110 }
1111
1112 return (uint8_t)buf[0];
1113}
1114
1115/* Static `masked rejection` function called by random_bounded_uint64(...) */
1116static inline uint64_t bounded_masked_uint64(bitgen_t *bitgen_state,

Calls 1

next_uint32Function · 0.85

Tested by

no test coverage detected