i don't find my question or i don't know how to search about it.
My problem is:
private final String alfabetohexa = "0123456789ABCDEF";
private final int n = alfabetohexa.length();
Random random = new Random();
public void generarMuestras(){
for (int i = 0; i < 3; i++) {
System.out.print(alfabetohexa.charAt(random.nextInt(n)));
System.out.println(n);
}
}
I want to get a random Hex String (i want to save it in a ArrayList) with 10 digits (No more, no less) this code generate 9 digits and if I change the comparator with "i" to 4, I get 12 digits.
How can I do it?
Aucun commentaire:
Enregistrer un commentaire