pystencils.sympyextensions.random.RngBase#

class pystencils.sympyextensions.random.RngBase(state)#

Abstract base class for counter-based random number generators.

Parameters:

state (RngState)

classmethod is_invocation(expr)#

Determine if the given expression is an RNG invocation

Return type:

bool

Parameters:

expr (Expr)

classmethod get_invocation_state(expr)#

If expr is an RNG invocation, return its state; return None otherwise.

Return type:

RngState | None

Parameters:

expr (Expr)

property dtype: PsIeeeFloatType#

Data type of the random numbers

property vector_size: int#

Number of random numbers returned by a single invocation

get_random_vector(counter)#

Get a symbolic invocation of the RNG and a symbol representing its result.

Parameters:

counter (Expr | int) – An expression specifying the external counter part of the RNG state, e.g. the time step counter

Return type:

tuple[IndexedBase, Assignment]