A recursive function to generate random number between 100000 and 1000000
import java.util.Random; public class Recursive { public static long randomNum() { Random randomGenerator = new Random(); int randomInt = randomGenerator.nextInt(1000000); if (randomInt >= 100000) { return randomInt; } else { return randomNum(); } } }