lundi 23 mai 2016

Easy way to create Random numbers in Java

I'm searching for an easy way to generate random numbers with a defined max and minimum, but for the purpose I need using the standard way to generate randoms complicates my code too much. The standard way being:

Random rand=new Random();
rand.nextInt(125)+1;

While I'm looking for a simpler way, something along the lines of:

Random(125,1);




Aucun commentaire:

Enregistrer un commentaire