Bonjour,
Après plusieurs recherches sur internet, je viens ici pour avoir une réponse.
J'aimerais tester une méthode qui me renvoi un char aléatoire. Je ne trouve pas comment tester ceci...
Code:
1
2
3
4
5
6
7
8 private String alphabet = "abcdefghijklmnopqrstuvwxyz"; public char letterRandom() { Random r = new Random(); int val = r.nextInt(alphabet.length()); char lettreRandom = alphabet.charAt(val); return lettreRandom; }
Merci d'avance pour votre aide !