JMSL SequentialCollection Demo: random behavior
 

Two MusicJobs in a sequential collection. The collection acts "behaviorally" instead of sequentially. Instead of launching each child in a strict sequential order, it uses a user-defined Behavior to choose which child to launch each time the collection repeats. This collection uses the UniformRandomBehavior which simply chooses a child with a randomly every time (ie in the case of two children, it's a coin flip)
In the source, look for the line that says

col.setBehavior(new UniformRandomBehavior())
. That's all that's needed.

You need a Java-enabled browser to view this applet.

source code


(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved
JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.
JMSL Examples