import java.util.Random; Random rand = new Random(); // You can also provide bound to it rand.nextInt();