I find this acceptable.
Okay, here's a first cut at an approach to allow repeats drawn from a distribution. If there are certain very common distribution needs, we could make those built into the class, but for now you have to roll you own.
The revised code (which is NOT out on SVN) is attached. The modified files are Schedule.java, Repeat.java, RandomRepeat.java, all of which should be placed into sim/engine/
Let's say you want to schedule something which repeatedly reschedules itself using the absolute value of a standard normal distribution, plus 1.0. You could say this:
Steppable step = ...
double initialTime = 5.0;
int initialOrdering = 0;
RandomRepeat repeat = new RandomRepeat(step, initialOrdering, false) // use 'true' if multithreaded
protected double getNextTime(SimState state, double currentTime)
return currentTime + Math.abs(state.random.nextGaussian()) + 1.0;
state.schedule.scheduleOnce(initialTIme, initialOrdering, repeat);
This code was written at 12:50 at night and has not been tested or even tried. But there is a slight chance it might work right. Anyway, it's a first draft which uses an abstract superclass and anonymous subclass to get around the issue of a multitude of distribution APIs in sim.util.distribution. Opinions?