Source Code : Using the ThreadLocalRandom class to support multiple threads
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Using the ThreadLocalRandom class to support multiple threads
import java.util.concurrent.ThreadLocalRandom;
public class Test {
public static void main(String[] args) {
System.out.println("Five random integers");
for (int i = 0; i < 5; i++) {
System.out.println(ThreadLocalRandom.current().nextInt());
}
System.out.println("Random double number between 0.0 and 35.0");
System.out.println(ThreadLocalRandom.current().nextDouble(35.0));
System.out.println("Five random Long numbers between 1234567 and 7654321");
for (int i = 0; i < 5; i++) {
System.out.println(ThreadLocalRandom.current().nextLong(1234567L,
7654321L));
}
}
}
Thank with us