public long getSleepTime() {
return Rand.randomLong(2000, 4000);
}
public Event pullEvent() {
Event event = Event.createDataEvent("/stocks/aex");
int stockNumber = Rand.randomInt(0, (stocks.length) / 2 - 1);
int nextStockIndex = 2 * stockNumber;
event.setField("number", "" + stockNumber);
event.setField("name", stocks[nextStockIndex]);
if (stocks[nextStockIndex + 1] == null) {
stocks[nextStockIndex + 1] = "" + Rand.randomInt(50, 150);
}
int currentStockValue = new Integer(stocks[nextStockIndex + 1]).intValue();
int newStockValue = currentStockValue + Rand.randomInt(-2, 2);
event.setField("rate", "" + newStockValue + "." + Rand.randomInt(0, 99));
return event;
}