sclass Probabilistic implements IProbabilistic { IProbabilisticScheduler ps; public void setScheduler(IProbabilisticScheduler ps) { this.ps = ps; } void schedule(double probability, Runnable action) { ps.at(probability, action); } void scheduleAll(double probability, Iterabel actions) { forEach(actions, a -> schedule(probability, a)); } }