java sleep random milliseconds code example Example: wait random time java Thread.sleep((long)(Math.random() * 1000));