Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.ThreadLocalRandom; public class ThreadLocalRandomSetSeedExample1 { public static void main(String args[]) { final ThreadLocalRandom random = ThreadLocalRandom.current(); random.setSeed(15); //exception will come as seeding is not allowed in ThreadLocalRandom. System.out.println("Seeded Thread Local Random Integer: " + random.nextInt()); } }
Output