Here you can find the source of sleepThreadForOneToSuppliedSecond(Thread t, int seconds)
Parameter | Description |
---|---|
t | Thread |
seconds | int |
Parameter | Description |
---|---|
InterruptedException | InterruptedException |
@SuppressWarnings("AccessStaticViaInstance") public static void sleepThreadForOneToSuppliedSecond(Thread t, int seconds) throws InterruptedException
//package com.java2s; //License from project: Open Source License public class Main { /**//from www . jav a 2 s . co m * Sleep a thread for a number of seconds. * * @param t Thread * @param seconds int * @throws InterruptedException InterruptedException */ @SuppressWarnings("AccessStaticViaInstance") public static void sleepThreadForOneToSuppliedSecond(Thread t, int seconds) throws InterruptedException { t.sleep(((int) (Math.random() * seconds) + 1) * 1000); } }