jeudi 5 janvier 2017

How to regenerate int if it same

I would like to regenerate a random Int. I generate 3 Int like this :

                Random a = new Random();
                int testa = a.nextInt(9 - 1) + 1;
                Random b = new Random();
                int testb = b.nextInt(9 - 1) + 1;
                Random c = new Random();
                int testc = c.nextInt(9 - 1) + 1;
               
And if 1 of them is same, I want to regenerate the Int. How?


Aucun commentaire:

Enregistrer un commentaire