sampo.schemas.interval#
Overview#
A class for generating random numbers from a given boundary and distribution. |
|
Implementation for uniform distribution |
|
Implementation for Gaussian distribution |
Classes#
- class sampo.schemas.interval.Interval#
Bases:
sampo.schemas.serializable.AutoJSONSerializable[BaseReq],abc.ABCA class for generating random numbers from a given boundary and distribution.
- abstract rand_float(rand: random.Random | None = None) float#
Returns a random float in the interval boundary according to the distribution of the class
- Parameters:
rand – object for generating random numbers
- Return kind:
the random float
- abstract rand_int(rand: random.Random | None = None) int#
Returns a random int in the interval boundary according to the distribution of the class
- Parameters:
rand – object for generating random numbers
- Return kind:
the random int
- class sampo.schemas.interval.IntervalUniform#
Bases:
IntervalImplementation for uniform distribution
- Parameters:
min_val – left border for the interval
max_val – right border for the interval
rand – object for generating random numbers with, if you want to use a randomizer with a determined seed
- min_val: float#
- max_val: float#
- rand: random.Random | None#
- rand_float(rand: random.Random | None = None) float#
Returns a random float in the interval boundary according to the distribution of the class
- Parameters:
rand – object for generating random numbers, if you want to use a randomizer with a determined seed
- Return kind:
the random float
- rand_int(rand: random.Random | None = None) int#
Returns a random int in the interval boundary according to the distribution of the class
- Parameters:
rand – object for generating random numbers, if you want to use a randomizer with a determined seed
- Return kind:
the random int
- class sampo.schemas.interval.IntervalGaussian#
Bases:
IntervalImplementation for Gaussian distribution
- Parameters:
mean – mean for the distribution
sigma – variance for the distribution
min_val – left border for the interval
max_val – right border for the interval
rand – object for generating random numbers with, if you want to use a randomizer with a determined seed
- mean: float#
- sigma: float#
- min_val: float | None#
- max_val: float | None#
- rand: random.Random | None#
- rand_float(rand: random.Random | None = None) float#
Returns a random float in the interval boundary according to the distribution of the class
- Parameters:
rand – object for generating random numbers
- Return kind:
the random float
- rand_int(rand: random.Random | None = None) int#
Returns a random int in the interval boundary according to the distribution of the class
- Parameters:
rand – object for generating random numbers
- Return kind:
the random int
Attributes#
- sampo.schemas.interval.EPS = 100000.0#
- sampo.schemas.interval.INF#
- sampo.schemas.interval.MINUS_INF#