// Thread safe random number generator. import java.util.concurrent.ThreadLocalRandom; // Generate random integers int val = ThreadLocalRandom.current().nextInt(); // Print random int System.out.println("Random Integer: " + val);