Does Time[rand.nextInt(Time.size())] actually do what you want here? I *think* it will re-evaluate that expression every time through the loop, when I'm guessing that your intention was to evaluate it once and then go that many times.