Class DiscreteRandomSource

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class DiscreteRandomSource
    extends RandomSource

    An actor that produces tokens with a given probability mass function.

    The probability mass function is a parameter, pmf, of this actor. The pmf must be an array that contains entries that are all between 0.0 and 1.1, and sum to 1.0. By default, pmf is initialized to {0.5, 0.5}.

    Output values are selected at random from the values parameter, which contains an ArrayToken. This array must have the same length as pmf. Thus the i-th token in values has probability pmf[i]. The output port has the same type as the elements of the values array. The default values are {0, 1}, which are integers.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Jeff Tsay, Yuhong Xiong
    Pt.AcceptedRating:
    Yellow (ssachs)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • pmf

        public Parameter pmf
        The probability mass function. This parameter contains an array of doubles, with default value {0.5, 0.5}.
      • values

        public Parameter values
        The values to be sent to the output. This parameter contains an ArrayToken, initially with value {0, 1} (an int array).