Java Sleep sleepRandMs(int ms)

Here you can find the source of sleepRandMs(int ms)

Description

sleep Rand Ms

License

Open Source License

Declaration

public static final void sleepRandMs(int ms) 

Method Source Code

//package com.java2s;

public class Main {
    public static final void sleepRandMs(int ms) {
        sleepMs((long) (Math.random() * ms));
    }/* ww w  .j av  a 2s .  c om*/

    public final static void sleepMs(long ms) {
        if (ms > 0) {
            try {
                Thread.sleep(ms);
            } catch (InterruptedException e) {
                // Thread.currentThread().dumpStack();
            }
        }
    }
}

Related

  1. sleepQuietly(int millis)
  2. sleepQuietly(long millis)
  3. sleepQuietly(long millis)
  4. sleepQuietly(long ms)
  5. sleepQuite(long millis)
  6. sleepRandom(long floor, long ceiling)
  7. sleepRandom(long timeout)
  8. sleepSafely(final long millis)
  9. sleepSilently(int millis)