You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / docs

Doc

C API for random

docs/reference:random:c-api

Access to various distributions below is available via Cython or C-wrapper libraries like CFFI. All the functions accept a bitgen_t as their first argument. To access these from Cython or C, you must link with the npyrandom static library which is part of the NumPy distribution, located in numpy/random/lib. Note that you must also link with npymath, see linking-npymath.

See extending for examples of using these functions.

The functions are named with the following conventions:

  • "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

  • "fill" functions will fill the provided out with cnt values.

  • The functions without "standard" in their name require additional parameters to describe the distributions.

  • Functions with inv in their name are based on the slower inverse method instead of a ziggurat lookup algorithm, which is significantly faster. The non-ziggurat variants are used in corner cases and for legacy compatibility.

Generate a single integer

Generate random uint64 numbers in closed interval [off, off + rng].