import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Ideone {
public static void main
(String[] args
) { char mat[][] = new char[5][5];
List<Integer> random = randomNumbers(65, 90, 25);
int posicao = 0;
for (int ctlin = 0; ctlin < 5; ctlin++)
for (int ctcol = 0; ctcol < 5; ctcol++)
mat[ctlin][ctcol] = (char)(int)random.get(posicao++);
for (int ctlin = 0; ctlin < 5; ctlin++) {
for (int ctcol = 0; ctcol < 5; ctcol++)
System.
out.
print(mat
[ctlin
][ctcol
] + " "); }
}
public static List<Integer> randomNumbers(int start, int end, int count) {
List<Integer> lista = new ArrayList<>(end - start + 1);
for (int i = start; i <= end; i++) {
lista.add(i);
}
lista = lista.subList(0, count);
return lista;
}
}
aW1wb3J0IGphdmEudXRpbC5BcnJheUxpc3Q7CmltcG9ydCBqYXZhLnV0aWwuQ29sbGVjdGlvbnM7CmltcG9ydCBqYXZhLnV0aWwuTGlzdDsKIApjbGFzcyBJZGVvbmUgewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHsKCQljaGFyIG1hdFtdW10gPSBuZXcgY2hhcls1XVs1XTsKCQlMaXN0PEludGVnZXI+IHJhbmRvbSA9IHJhbmRvbU51bWJlcnMoNjUsIDkwLCAyNSk7CgkJaW50IHBvc2ljYW8gID0gMDsKICAgICAgICBmb3IgKGludCBjdGxpbiA9IDA7IGN0bGluIDwgNTsgY3RsaW4rKykKICAgICAgICAgICAgZm9yIChpbnQgY3Rjb2wgPSAwOyBjdGNvbCA8IDU7IGN0Y29sKyspCiAgICAgICAgICAgICAgICBtYXRbY3RsaW5dW2N0Y29sXSA9IChjaGFyKShpbnQpcmFuZG9tLmdldChwb3NpY2FvKyspOwogICAgICAgIGZvciAoaW50IGN0bGluID0gMDsgY3RsaW4gPCA1OyBjdGxpbisrKSB7CiAgICAgICAgICAgIGZvciAoaW50IGN0Y29sID0gMDsgY3Rjb2wgPCA1OyBjdGNvbCsrKQogICAgICAgICAgICAgICAgU3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