DistDiscreteUniform

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

Bases: DistDiscrete

The Discrete Uniform distribution is a discrete distribution function that models the probability of drawing from a range of integer numbers with equal probabilities. Rolling a dice is an example of such a distribution.

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

Constructs a Discrete uniform distribution. The distribution draws from a range of integer numbers with equal probabilities. Rolling a dice is an example of such a distribution.

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

  • lo (int) – the lowest value to draw (inclusive)

  • hi (int) – the highest value to draw (inclusive)

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

  • TypeError – when lo or hi is not an int:

  • ValueError – when lo >= hi:

draw() int[source]

Draw a value from the Discrete Uniform distribution.

probability(observation: int) float[source]

Returns the probability of the observation for the distribution.

property lo: int

Return the parameter value lo (lowest value, inclusive)

property hi: int

Return the parameter value hi (highest value, inclusive)

property stream: StreamInterface

Return the current random stream for this distribution.