Ajout du constructeur + attributs MIN et MAX pour la méthode getRandomBetween()

This commit is contained in:
Vincent Guillet
2025-04-28 17:57:33 +02:00
parent ffb376fede
commit 7ece472154

View File

@@ -7,6 +7,15 @@ public class JeuDevinette {
private int[] tentatives;
private final int MAX_TENTATIVES = 10;
private final int MIN = 1;
private final int MAX = 100;
public JeuDevinette() {
this.nombreADeviner = getRandomBetween(MIN, MAX);
this.nombreDeTentatives = 0;
this.tentatives = new int[MAX_TENTATIVES];
}
private int getRandomBetween(int min, int max) {
return (int)(Math.random() * (max - min + 1)) + min;
}