DistConstant

class pydsol.core.distributions.DistConstant(stream: StreamInterface, constant: float | int)[source]

Bases: DistContinuous

The Constant distribution is a continuous distribution that always returns the same value. It can be used in situations where a distribution function is expected, but actually a fixed value is used.

__init__(stream: StreamInterface, constant: float | int)[source]

Constructs a new Constant distribution that always returns the same value.

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

  • constant (float or int) – the value to return

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

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

draw() float[source]

Draw a value from the Beta distribution. Based on the algorithm in Law & Kelton, Simulation Modeling and Analysis, 1991, pages 492-493.

probability_density(x: float) float[source]

Returns the probability density value for value x.

property constant: float | int

Return the parameter value constant

property stream: StreamInterface

Return the current random stream for this distribution.