* q.enqueue(new Object(), 8.3); q.enqueue(new Object(), 22.3);
*/
int distrib = 3;
StopWatch sw = new StopWatch();
sw.start();
for (int i = 0; i < 100000; i++) {
double rand = Math.random();
switch (distrib) {
case 0:
// Exponential
q.enqueue(getObj(), -Math.log(rand));
break;
case 1:
// Uniform 0.0 - 2.0
q.enqueue(getObj(), 2 * rand);
break;
case 2:
// Biased 0.9 - 1.1
q.enqueue(getObj(), 0.9 + 0.2 * rand);
break;
case 3: {
// Biomodal
if (rand < 0.1) {
q.enqueue(getObj(), 0.95238 + 9.5238 * rand);
} else {
q.enqueue(getObj(), 0.95238 + rand);
}
break;
}
case 4:
// Triangular
q.enqueue(getObj(), 1.5 * Math.pow(rand, 0.5));
}
}
sw.stop();
System.out.println("Enqueing took " + sw.elapsedSeconds() + " seconds ");
/*
* System.out.println("The event queue (intially filled)");
* q.print(System.out);
*/