diff options
author | mattip <matti.picus@gmail.com> | 2019-06-26 00:45:41 +0300 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2019-06-26 01:13:48 +0300 |
commit | efa35e738027dc833c0d02c8b15f41c9cf547749 (patch) | |
tree | fd2611d808bd0a76d70dc2648eb1615fc4faefc4 /numpy/random/src | |
parent | 8bb4645fe56c6fc107ca5c5bef7a05802112cfdf (diff) | |
download | numpy-efa35e738027dc833c0d02c8b15f41c9cf547749.tar.gz |
ENH: use SeedSequence to generate entropy for seeding
Diffstat (limited to 'numpy/random/src')
-rw-r--r-- | numpy/random/src/bitgen.h | 18 | ||||
-rw-r--r-- | numpy/random/src/distributions/distributions.h | 9 | ||||
-rw-r--r-- | numpy/random/src/pcg64/pcg64.h | 4 |
3 files changed, 19 insertions, 12 deletions
diff --git a/numpy/random/src/bitgen.h b/numpy/random/src/bitgen.h new file mode 100644 index 000000000..9ebc15346 --- /dev/null +++ b/numpy/random/src/bitgen.h @@ -0,0 +1,18 @@ +#ifndef _RANDOM_BITGEN_H +#define _RANDOM_BITGEN_H + +#pragma once +#include <stddef.h> +#include <stdbool.h> +#include <stdint.h> + +typedef struct bitgen { + void *state; + uint64_t (*next_uint64)(void *st); + uint32_t (*next_uint32)(void *st); + double (*next_double)(void *st); + uint64_t (*next_raw)(void *st); +} bitgen_t; + + +#endif diff --git a/numpy/random/src/distributions/distributions.h b/numpy/random/src/distributions/distributions.h index 3178725af..03b8ec371 100644 --- a/numpy/random/src/distributions/distributions.h +++ b/numpy/random/src/distributions/distributions.h @@ -9,6 +9,7 @@ #include "Python.h" #include "numpy/npy_common.h" #include "numpy/npy_math.h" +#include "src/bitgen.h" /* * RAND_INT_TYPE is used to share integer generators with RandomState which @@ -59,14 +60,6 @@ typedef struct s_binomial_t { double p4; } binomial_t; -typedef struct bitgen { - void *state; - uint64_t (*next_uint64)(void *st); - uint32_t (*next_uint32)(void *st); - double (*next_double)(void *st); - uint64_t (*next_raw)(void *st); -} bitgen_t; - /* Inline generators for internal use */ static NPY_INLINE uint32_t next_uint32(bitgen_t *bitgen_state) { return bitgen_state->next_uint32(bitgen_state->state); diff --git a/numpy/random/src/pcg64/pcg64.h b/numpy/random/src/pcg64/pcg64.h index f8578bfb3..20d64f8ab 100644 --- a/numpy/random/src/pcg64/pcg64.h +++ b/numpy/random/src/pcg64/pcg64.h @@ -53,10 +53,6 @@ #ifdef _WIN32 #include <stdlib.h> #define inline __forceinline -#if _MSC_VER >= 1900 && _M_AMD64 -#include <intrin.h> -#pragma intrinsic(_umul128) -#endif #endif #if __GNUC_GNU_INLINE__ && !defined(__cplusplus) |