Advertisement
mmayoub

ServiveOffice, Utils class

Aug 24th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package ServicePkg;
  2.  
  3. import java.util.Date;
  4. import java.util.Random;
  5.  
  6. public class Utils {
  7.     public static final int minServiceTime = 300;
  8.     public static final int maxServiceTime = 600;
  9.  
  10.     public static final int minTimeToNextCustomer = 100;
  11.     public static final int maxTimeToNextCustomer = 200;
  12.  
  13.     private static Random rnd = new Random();
  14.  
  15.     public static void printLog(String logMessage) {
  16.         System.out.println((new Date()).getTime() + " : " + logMessage);
  17.     }
  18.  
  19.     public static int getRandomServiceTime() {
  20.         return minServiceTime
  21.                 + rnd.nextInt(maxServiceTime - minServiceTime + 1);
  22.     }
  23.  
  24.     public static int getRandomTimeToNextCustomer() {
  25.         return minTimeToNextCustomer
  26.                 + rnd.nextInt(maxTimeToNextCustomer - minTimeToNextCustomer + 1);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement