uniform#

bamengine.ops.uniform(rng, low, high, size)[source]#

Draw samples from uniform distribution.

Parameters:
  • rng (Generator) – NumPy random number generator (from sim.rng).

  • low (float) – Lower bound (inclusive).

  • high (float) – Upper bound (exclusive).

  • size (int) – Number of samples.

Returns:

Random samples.

Return type:

array

Examples

>>> import bamengine.ops as ops
>>> # In custom event:
>>> def execute(self, sim):
...     # Random shocks for each firm
...     shocks = ops.uniform(sim.rng, 0.0, 0.1, sim.n_firms)