Generation

generate functionWed, 19 Apr 2023

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(); } } }

Want to kickstart your project?Use the new AI Studio to create your code