diff --git a/numpy/random/src/distributions/distributions.c b/numpy/random/src/distributions/distributions.c index def29d850cfd..109a62d18d67 100644 --- a/numpy/random/src/distributions/distributions.c +++ b/numpy/random/src/distributions/distributions.c @@ -169,7 +169,7 @@ float random_standard_exponential_zig_f(bitgen_t *bitgen_state) { static NPY_INLINE double next_gauss_zig(bitgen_t *bitgen_state) { uint64_t r; int sign; - int64_t rabs; + uint64_t rabs; int idx; double x, xx, yy; for (;;) { @@ -178,7 +178,7 @@ static NPY_INLINE double next_gauss_zig(bitgen_t *bitgen_state) { idx = r & 0xff; r >>= 8; sign = r & 0x1; - rabs = (int64_t)((r >> 1) & 0x000fffffffffffff); + rabs = (r >> 1) & 0x000fffffffffffff; x = rabs * wi_double[idx]; if (sign & 0x1) x = -x; @@ -215,7 +215,7 @@ void random_gauss_zig_fill(bitgen_t *bitgen_state, npy_intp cnt, double *out) { float random_gauss_zig_f(bitgen_t *bitgen_state) { uint32_t r; int sign; - int32_t rabs; + uint32_t rabs; int idx; float x, xx, yy; for (;;) { @@ -223,7 +223,7 @@ float random_gauss_zig_f(bitgen_t *bitgen_state) { r = next_uint32(bitgen_state); idx = r & 0xff; sign = (r >> 8) & 0x1; - rabs = (int32_t)((r >> 9) & 0x0007fffff); + rabs = (r >> 9) & 0x0007fffff; x = rabs * wi_float[idx]; if (sign & 0x1) x = -x; diff --git a/numpy/random/src/xoshiro256/xoshiro256.c b/numpy/random/src/xoshiro256/xoshiro256.c index f5cda27214d0..a9ac49aa67b0 100644 --- a/numpy/random/src/xoshiro256/xoshiro256.c +++ b/numpy/random/src/xoshiro256/xoshiro256.c @@ -6,6 +6,7 @@ worldwide. This software is distributed without any warranty. See . */ +#include #include "xoshiro256.h" /* This is xoshiro256** 1.0, our all-purpose, rock-solid generator. It has @@ -29,7 +30,7 @@ extern NPY_INLINE uint32_t xoshiro256_next32(xoshiro256_state *state); void xoshiro256_jump(xoshiro256_state *state) { - int i, b; + size_t i, b; static const uint64_t JUMP[] = {0x180ec6d33cfd0aba, 0xd5a61266f0c9392c, 0xa9582618e03fc9aa, 0x39abdc4529b1661c}; uint64_t s0 = 0; diff --git a/numpy/random/src/xoshiro512/xoshiro512.c b/numpy/random/src/xoshiro512/xoshiro512.c index 9fdbed125a34..4f4af86f0c8f 100644 --- a/numpy/random/src/xoshiro512/xoshiro512.c +++ b/numpy/random/src/xoshiro512/xoshiro512.c @@ -6,6 +6,7 @@ worldwide. This software is distributed without any warranty. See . */ +#include #include "xoshiro512.h" /* This is xoshiro512** 1.0, an all-purpose, rock-solid generator. It has @@ -32,7 +33,7 @@ static uint64_t s_placeholder[8]; void xoshiro512_jump(xoshiro512_state *state) { - int i, b, w; + size_t i, b, w; static const uint64_t JUMP[] = {0x33ed89b6e7a353f9, 0x760083d7955323be, 0x2837f2fbb5f22fae, 0x4b8c5674d309511c, 0xb11ac47a7ba28c25, 0xf1be7667092bcc1c,