diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-01-03 15:29:31 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2016-01-03 15:29:31 -0700 |
commit | 9fb9288f461c7c7af9708f136fa4f29acdc734a8 (patch) | |
tree | e4848c8e1ad3298b2c0856e446566388ce87f5d7 /numpy/random/mtrand/randomkit.h | |
parent | 5dab9275475e70630d7b1242c3530a6726c61fa2 (diff) | |
parent | bc2a97bde26a026e75adec7ec70566be3005c47c (diff) | |
download | numpy-9fb9288f461c7c7af9708f136fa4f29acdc734a8.tar.gz |
Merge pull request #6910 from charris/add-64-bit-random-int
ENH: Add dtype argument to random.randint.
Diffstat (limited to 'numpy/random/mtrand/randomkit.h')
-rw-r--r-- | numpy/random/mtrand/randomkit.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/numpy/random/mtrand/randomkit.h b/numpy/random/mtrand/randomkit.h index e049488ee..fcdd606a1 100644 --- a/numpy/random/mtrand/randomkit.h +++ b/numpy/random/mtrand/randomkit.h @@ -56,11 +56,13 @@ * defaults to "/dev/urandom" */ -#include <stddef.h> - #ifndef _RANDOMKIT_ #define _RANDOMKIT_ +#include <stddef.h> +#include <numpy/npy_common.h> + + #define RK_STATE_LEN 624 typedef struct rk_state_ @@ -149,6 +151,41 @@ extern unsigned long rk_ulong(rk_state *state); extern unsigned long rk_interval(unsigned long max, rk_state *state); /* + * Fills an array with cnt random npy_uint64 between off and off + rng + * inclusive. The numbers wrap if rng is sufficiently large. + */ +extern void rk_random_uint64(npy_uint64 off, npy_uint64 rng, npy_intp cnt, + npy_uint64 *out, rk_state *state); + +/* + * Fills an array with cnt random npy_uint32 between off and off + rng + * inclusive. The numbers wrap if rng is sufficiently large. + */ +extern void rk_random_uint32(npy_uint32 off, npy_uint32 rng, npy_intp cnt, + npy_uint32 *out, rk_state *state); + +/* + * Fills an array with cnt random npy_uint16 between off and off + rng + * inclusive. The numbers wrap if rng is sufficiently large. + */ +extern void rk_random_uint16(npy_uint16 off, npy_uint16 rng, npy_intp cnt, + npy_uint16 *out, rk_state *state); + +/* + * Fills an array with cnt random npy_uint8 between off and off + rng + * inclusive. The numbers wrap if rng is sufficiently large. + */ +extern void rk_random_uint8(npy_uint8 off, npy_uint8 rng, npy_intp cnt, + npy_uint8 *out, rk_state *state); + +/* + * Fills an array with cnt random npy_bool between off and off + rng + * inclusive. It is assumed tha npy_bool as the same size as npy_uint8. + */ +extern void rk_random_bool(npy_bool off, npy_bool rng, npy_intp cnt, + npy_bool *out, rk_state *state); + +/* * Returns a random double between 0.0 and 1.0, 1.0 excluded. */ extern double rk_double(rk_state *state); |