Typed versions of many of the Generator and BitGenerator can be accessed directly from Cython: the complete list is given below.
Generator
BitGenerator
The _bit_generator module is usable via:
_bit_generator
cimport numpy.random._bit_generator
It provides function pointers for quickly accessing the next bytes in the BitGenerator:
struct bitgen: void *state uint64_t (*next_uint64)(void *st) nogil uint32_t (*next_uint32)(void *st) nogil double (*next_double)(void *st) nogil uint64_t (*next_raw)(void *st) nogil ctypedef bitgen bitgen_t
See extending for examples of using these functions.
The _generator module is usable via:
_generator
cimport numpy.random._generator
It provides low-level functions for various distributions. All the functions require a bitgen_t BitGenerator structure. The functions are named with the followig cconventions:
bitgen_t
“standard” refers to the reference values for any parameters. For instance “standard_uniform” means a uniform distribution on the interval 0.0 to 1.0
0.0
1.0
“fill” functions will fill the provided out with cnt values.
out
cnt
The functions without “standard” in their name require additional parameters to describe the distributions.
random_standard_uniform
random_standard_uniform_fill
random_standard_exponential
random_standard_exponential_fill
random_standard_exponential_zig
random_standard_exponential_zig_fill
random_standard_normal
random_standard_normal_fill
random_standard_normal_fill_f
random_standard_gamma
random_standard_uniform_f
random_standard_uniform_fill_f
random_standard_exponential_f
random_standard_exponential_zig_f
random_standard_exponential_fill_f
random_standard_exponential_zig_fill_f
random_standard_normal_f
random_standard_gamma_f
random_normal
random_gamma
random_gamma_f
random_exponential
random_uniform
random_beta
random_chisquare
random_f
random_standard_cauchy
random_pareto
random_weibull
random_power
random_laplace
random_gumbel
random_logistic
random_lognormal
random_rayleigh
random_standard_t
double random_noncentral_chisquare(bitgen_t *bitgen_state, double df,
double nonc)
double random_noncentral_f(bitgen_t *bitgen_state, double dfnum,
double dfden, double nonc)
random_wald
random_vonmises
double random_triangular(bitgen_t *bitgen_state, double left, double mode,
double right)
random_poisson
random_negative_binomial
random_binomial
random_logseries
random_geometric_search
random_geometric_inversion
random_geometric
random_zipf
int64_t random_hypergeometric(bitgen_t *bitgen_state, int64_t good, int64_t bad,
int64_t sample)
random_interval
void random_multinomial(bitgen_t *bitgen_state, int64_t n, int64_t *mnix,
double *pix, np.npy_intp d, binomial_t *binomial)
int random_mvhg_count(bitgen_t *bitgen_state,
int64_t total,
size_t num_colors, int64_t *colors,
int64_t nsample,
size_t num_variates, int64_t *variates)
void random_mvhg_marginals(bitgen_t *bitgen_state,
Generate a single integer
random_positive_int64
random_positive_int32
random_positive_int
random_uint
Generate random uint64 numbers in closed interval [off, off + rng].
uint64_t random_bounded_uint64(bitgen_t *bitgen_state,
uint64_t off, uint64_t rng,
uint64_t mask, bint use_masked)