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

Function buffered_uint16

numpy/random/src/distributions/distributions.c:1088–1099  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1086
1087/* Generate 16 bit random numbers using a 32 bit buffer. */
1088static inline uint16_t buffered_uint16(bitgen_t *bitgen_state, int *bcnt,
1089 uint32_t *buf) {
1090 if (!(bcnt[0])) {
1091 buf[0] = next_uint32(bitgen_state);
1092 bcnt[0] = 1;
1093 } else {
1094 buf[0] >>= 16;
1095 bcnt[0] -= 1;
1096 }
1097
1098 return (uint16_t)buf[0];
1099}
1100
1101/* Generate 8 bit random numbers using a 32 bit buffer. */
1102static inline uint8_t buffered_uint8(bitgen_t *bitgen_state, int *bcnt,

Calls 1

next_uint32Function · 0.85

Tested by

no test coverage detected