vendredi 20 janvier 2017

Random Generator with range + exception

I want to create a random generator with a range (defined by var1), and a exception (defined by blockvar1)

I wrote this - it didn't work:

Random rand = new Random();

    int var1 = rand.nextInt(var1) + 1;
    do{
        blockvar1 = rand.nextInt(var1) + 1;
    }while (var1 == blockvar1);




Aucun commentaire:

Enregistrer un commentaire