Salve Galera estou com um problema que não estou conseguindo resolver meu código gera as letras randômica tipo:
a
f
r
h
r
Mas eu gostaria que ele gera-se frase randômica tipo:
redffs
afsaa
sdfasf
asfae
Não sei se deu para entender e me perdoe pelo código sou principiante ainda em programação se alguém poder me ajudar muito obrigado
private void InicioActionPerformed(java.awt.event.ActionEvent evt) {
long inicioB;
long fim;
long resultado;
int quantidade = 1000;
Random random = new Random();
String vet[] = new String[quantidade];
String base[] = {“A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”, “I”, “J”, “L”,
“M”, “N”, “O”, “P”, “Q”, “R”, “S”, “T”, “U”, “V”, “X”, “Z”};
Random rand = new Random();
for (int inicio = 0; inicio < vet.length; inicio++) {
vet[inicio] = base[random.nextInt(base.length)];
System.out.println(vet[inicio]);
}
//System.out.println(vet[inicio]);
inicioB = System.currentTimeMillis();
bubbleSort(vet);
fim = System.currentTimeMillis();
resultado = (fim - inicioB);
//System.out.printf("%.3f ms%n", (fim - inicio) / 1000d);
txtTempoB.setText(txtTempoB.getText() + ((resultado) / 1000d) + " ms");
}
/////////////////////////Bubble///////////////
public static void bubbleSort(String[] tamanho) {
for (int i = 0; i < tamanho.length - 1; i++) {
for (int j = 0; j < tamanho.length - 1 - i; j++) {
if(tamanho[j].compareTo(tamanho[ j+1 ])>0) {
String auxiliar = tamanho[j];
tamanho[j] = tamanho[j + 1];
tamanho[j + 1] = auxiliar;
}
}
}
}
/////////////////////////Bubble/////////////////////////////////////