Class BooleanRandomVariable

java.lang.Object
org.bzdev.math.rv.RandomVariable<Boolean>
org.bzdev.math.rv.BooleanRandomVariable
All Implemented Interfaces:
Cloneable, RandomVariableOps<Boolean>
Direct Known Subclasses:
BinomialBooleanRV, DetermBooleanRV, FixedBooleanRV, UniformBooleanRV

public abstract class BooleanRandomVariable extends RandomVariable<Boolean>
Base class for Boolean-valued random numbers. The setMinimum, setMaximum, setRequiredMinimum, setRequiredMaximum, tightenMinimum, tightenMaximum,, tightenMinimumS, and tightenMaximumS methods from the RandomVariable interface throw an UnsupportedOperationException as boolean values are not ordered.
  • Constructor Details

    • BooleanRandomVariable

      public BooleanRandomVariable()
  • Method Details

    • tightenMinimumS

      public void tightenMinimumS(String s, boolean closed) throws UnsupportedOperationException
      Description copied from class: RandomVariable
      Tighten the minimum value for a random variable given a string. If there is no minimum value, it will be set. Otherwise the minimum of the allowed range will not decrease. The string argument is a number in a format acceptable to the constructors for Integer, Long, or Double as appropriate.
      Specified by:
      tightenMinimumS in interface RandomVariableOps<Boolean>
      Specified by:
      tightenMinimumS in class RandomVariable<Boolean>
      Parameters:
      s - 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 reasons
    • tightenMaximumS

      public void tightenMaximumS(String s, boolean closed) throws UnsupportedOperationException
      Description copied from class: RandomVariable
      Tighten the maximum value for a random variable given a string. If there is no maximum value, it will be set. Otherwise the maximum of the allowed range will not increase. The string argument is a number in a format acceptable to the constructors for Integer, Long, or Double as appropriate.
      Specified by:
      tightenMaximumS in interface RandomVariableOps<Boolean>
      Specified by:
      tightenMaximumS in class RandomVariable<Boolean>
      Parameters:
      s - 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 reasons
    • stream

      public Stream<Boolean> stream(long size)
      Get a fixed-length stream of boolean values.
      Parameters:
      size - the number of random values to provide
      Returns:
      the stream
    • parallelStream

      public Stream<Boolean> parallelStream(long size)
      Get a fixed-length parallel stream of boolean values.
      Parameters:
      size - the number of random values to provide
      Returns:
      the stream
    • stream

      public Stream<Boolean> stream()
      Get an infinite stream of boolean values.
      Returns:
      the stream
    • parallelStream

      public Stream<Boolean> parallelStream()
      Get an infinite parallel stream of boolean values.
      Returns:
      the stream