DistUniform

class pydsol.core.distributions.DistUniform(stream: StreamInterface, lo: float, hi: float)[source]

Bases: DistContinuous

The Uniform distribution is a bounded distribution with equal probability of drawing a number between the low bound and the high bound. Since ‘min’ and ‘max’ are functions in Python, the normally used terms (min, max) to characterize a Uniform distribution have been replaced by (lo, hi). For more information on this distribution see https://mathworld.wolfram.com/UniformDistribution.html.

__init__(stream: StreamInterface, lo: float, hi: float)[source]

Construct a new Uniform distribution. The Uniform distribution is a bounded distribution with equal probability of drawing a number between the low bound and the high bound. Since ‘min’ and ‘max’ are functions in Python, the normally used terms (min, max) to characterize a Uniform distribution have been replaced by (lo, hi).

Parameters:
  • stream (StreamInterface) – the random stream to use for this distribution

  • lo (float) – the left bound of the distribution; lowest value that can be drawn

  • hi (float) – the right bound of the distribution; highest value that can be drawn

Raises:
  • TypeError – when stream is not implementing StreamInterface:

  • TypeError – when lo is not a float or int:

  • TypeError – when hi is not a float or int:

  • ValueError – when hi <= lo:

draw() float[source]

Draw a value from the Uniform distribution.

probability_density(x: float) float[source]

Returns the probability density value for value x.

property lo: float

Return the parameter value lo

property hi: int

Return the parameter value hi

property stream: StreamInterface

Return the current random stream for this distribution.