randomgen.wrapper.UserBitGenerator.from_ctypes

classmethod UserBitGenerator.from_ctypes(next_raw, next_64, next_32, next_double, state, state_getter=None, state_setter=None)
from_ctypes(next_raw, next_64, next_32, next_double, state,

state_getter=None, state_setter=None)

Construct a bit generator from ctypes pointers

Parameters:
next_raw

A CFunctionType returning ctypes.c_uint64 and taking one ctypes.c_void_p input that returns the next raw value from the underlying PRNG.

next_64

A CFunctionType returning ctypes.c_uint64 and taking one ctypes.c_void_p input that returns the next 64 bits from the underlying PRNG.

next_32

A CFunctionType returning ctypes.c_uint64 and taking one ctypes.c_void_p input that returns the next 32 bits from the underlying PRNG.

next_double

A CFunctionType returning ctypes.c_uint64 and taking one ctypes.c_void_p input that returns the next double in [0,1) value from the underlying PRNG.

state

A void pointer to the state. Passed to the next functions when generating random variates.

state_getter=None

A callable that returns the state of the bit generator. If not provided, getting the state property will raise NotImplementedError.

state_setter=None

A callable that sets the state of the bit generator. Must take a single input. If not provided, getting the state property will raise NotImplementedError.

Notes

See the documentation for an example of a generator written in C called using this interface.