Class RandomVariableRV<T,RV extends RandomVariable<T>>

java.lang.Object
org.bzdev.math.rv.RandomVariable<RV>
org.bzdev.math.rv.RandomVariableRV<T,RV>
All Implemented Interfaces:
Cloneable, RandomVariableOps<RV>, RandomVariableRVOps<T,RV>
Direct Known Subclasses:
BooleanRandomVariableRV, RandomVariableRVN

public abstract class RandomVariableRV<T,RV extends RandomVariable<T>> extends RandomVariable<RV> implements RandomVariableRVOps<T,RV>
Random variable that generates another random variable. This class provides a superclass for random variables that generate a random variable of some particular type. The random variable RV that an instance of this class generates is a random variable that generates values of type T. The use of two type parameters, T and RV, allows both to be used - some subclasses require protected methods that are cognizant of the type T (for example, a protected method named "cmp" used by RandomVariableRVN. The class does nothing other than providing a type constraint.

The interface RandomVariableRVOps corresponds to this class.

  • Constructor Details

    • RandomVariableRV

      public RandomVariableRV()
  • Method Details

    • determineIfOrdered

      protected void determineIfOrdered(RandomVariable... args)
      Determine if this random variable's streams must be ordered. Subclasses typically use random variables to generate a sequence of random variables, and If any of the random variables used are ordered, this random variable must also be ordered.

      A subclass's constructor should call this method if any of its arguments is a random variable unless that subclass overrides RandomVariable.getCharacteristics().

      Parameters:
      args - the random variables to check
      See Also:
    • getCharacteristics

      protected int getCharacteristics()
      Description copied from class: RandomVariable
      Spliterator characteristics. The characteristics returned should not include Spliterator.SIZED or Spliterator.SUBSIZED. The default value is Spliterator.IMMUTABLE | Spliterator.NONNULL. If the characteristics include Spliterator.ORDERED, Spliterator.trySplit() will return null. The characteristics include Spliterator.ORDERED for the random variables in this package that return a deterministic sequence of values.
      Overrides:
      getCharacteristics in class RandomVariable<RV extends RandomVariable<T>>
      Returns:
      the characteristics
    • stream

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

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

      public Stream<RV> stream()
      Get an infinite stream of random variables.
      Returns:
      the stream
    • parallelStream

      public Stream<RV> parallelStream()
      Get an infinite parallel stream of random variables.
      Returns:
      the stream