1 27 28 package org.objectweb.clif.scenario.util.timers; 29 30 33 public class UniformRandomTimer extends RandomTimer { 34 35 private long rand; 36 37 40 public UniformRandomTimer() { 41 } 42 43 48 public UniformRandomTimer(int min, int max) { 49 setRange(min, max); 50 } 51 52 56 public long getDelay() { 57 58 rand = (long) Math.round(getMin() + Math.random() * (getRange())); 59 return rand; 60 } 61 62 66 public void delay() { 67 try { 68 Thread.sleep(getDelay()); 69 } catch (InterruptedException e) { 70 e.printStackTrace(); 71 } 72 } 73 74 } 75 | Popular Tags |