simkit.test.TestDiscreteVariate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simkit Show documentation
Show all versions of simkit Show documentation
Descrete Event Simulation for the JVM)
The newest version!
/*
* Main.java
*
* Created on January 30, 2002, 6:03 PM
*/
package simkit.test;
import java.beans.PropertyChangeSupport;
import simkit.random.RandomVariate;
import simkit.random.RandomVariateFactory;
import simkit.stat.Histogram;
/**
*
* @author Arnold Buss
* @version $Id$
*/
public class TestDiscreteVariate {
/** Creates new Main */
public TestDiscreteVariate() {
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
RandomVariate rv =
RandomVariateFactory.getInstance(
"simkit.random.DiscreteVariate", new double[] {0, 1}, new double[] { 20, 20} );
System.out.println(rv);
Histogram h = new Histogram("discrete", 1);
PropertyChangeSupport pcs = new PropertyChangeSupport(rv);
pcs.addPropertyChangeListener("discrete", h);
for (int i = 0; i < 10; i++) {
System.out.println(rv.generate());
}
for (int i = 0; i < 10000; i++) {
pcs.firePropertyChange("discrete", null, new Double(rv.generate()));
}
System.out.println(h);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy