mardi 27 novembre 2018

How do I create Random Number generator using Recursion

I've created code to generate a random number between 1 and 100 but my question is how would I create the same output using recursion in java

 import java.util.Random;

 public class Recursion{




 public static void main(String[] args) {

   Random r = new Random();
   int random  = r.nextInt(100) + 1;
   System.out.println("Random number between 1 and 100 is: " + random);

}
}




Aucun commentaire:

Enregistrer un commentaire