java.lang.Object
org.bzdev.math.rv.RandomVariable<Long>
org.bzdev.math.rv.LongRandomVariable
org.bzdev.math.rv.FixedLongRV
- All Implemented Interfaces:
Cloneable
,RandomVariableOps<Long>
Random variable that always generates the same long integer.
Useful when passing a constant to a method that expects a
random variable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
getValue()
Get the value of this random variable, which is a constant.next()
Get the next value for a random variable.void
setMaximum
(Long max, boolean closed) Set the maximum value for a random variable.void
setMinimum
(Long min, boolean closed) Set the minimum value for a random variable.void
tightenMaximum
(Long max, boolean closed) Tighten the maximum value for a random variable.void
tightenMinimum
(Long min, boolean closed) Tighten the minimum value for a random variable.toString()
Methods inherited from class org.bzdev.math.rv.LongRandomVariable
getMaximum, getMaximumClosed, getMinimum, getMinimumClosed, parallelStream, parallelStream, rangeTestFailed, rangeTestNeeded, setRequiredMaximum, setRequiredMinimum, spliterator, spliterator, stream, stream, tightenMaximumS, tightenMinimumS
Methods inherited from class org.bzdev.math.rv.RandomVariable
clone, getCharacteristics
-
Constructor Details
-
FixedLongRV
public FixedLongRV(long value) Constructor.- Parameters:
value
- the value of the random variable
-
-
Method Details
-
getValue
public long getValue()Get the value of this random variable, which is a constant.- Returns:
- the value
-
setMinimum
public void setMinimum(Long min, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariable
Set the minimum value for a random variable.- Specified by:
setMinimum
in interfaceRandomVariableOps<Long>
- Overrides:
setMinimum
in classLongRandomVariable
- Parameters:
min
- minimum value.closed
- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
UnsupportedOperationException
- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException
- an argument is out of range
-
tightenMinimum
public void tightenMinimum(Long min, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariable
Tighten the minimum value for a random variable. If there is no minimum value, it will be set. Otherwise the minimum of the allowed range will not decrease.- Specified by:
tightenMinimum
in interfaceRandomVariableOps<Long>
- Overrides:
tightenMinimum
in classLongRandomVariable
- Parameters:
min
- minimum value.closed
- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
UnsupportedOperationException
- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException
- an argument is out of range
-
setMaximum
public void setMaximum(Long max, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariable
Set the maximum value for a random variable.- Specified by:
setMaximum
in interfaceRandomVariableOps<Long>
- Overrides:
setMaximum
in classLongRandomVariable
- Parameters:
max
- maximum value.closed
- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
UnsupportedOperationException
- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException
- an argument is out of range
-
tightenMaximum
public void tightenMaximum(Long max, boolean closed) throws UnsupportedOperationException, IllegalArgumentException Description copied from class:RandomVariable
Tighten the maximum value for a random variable. If there is no maximum value, it will be set. Otherwise the maximum of the allowed range will not increase.- Specified by:
tightenMaximum
in interfaceRandomVariableOps<Long>
- Overrides:
tightenMaximum
in classLongRandomVariable
- Parameters:
max
- maximum value.closed
- true if the minimum value is part of the range; false if it is a lower bound on the range- Throws:
UnsupportedOperationException
- the random variable's type does not have an order imposed on it or the operation is not supported for implementation reasonsIllegalArgumentException
- an argument is out of range
-
next
Description copied from class:RandomVariable
Get the next value for a random variable. In general, each value will be independent of the last.- Specified by:
next
in interfaceRandomVariableOps<Long>
- Specified by:
next
in classRandomVariable<Long>
- Returns:
- the next value
-
toString
-