Skip to content
Snippets Groups Projects
Commit 572dda57 authored by Uli Bähr's avatar Uli Bähr
Browse files

codebuch.sqlite => Steckbretteinträge mit unique letters

Klasse Codebuch => Methode steckverbindung() angepasst
(steckverbindungen() ist ausdokumentiert)
parent cca68cc7
No related branches found
No related tags found
1 merge request!24codebuch.sqlite => Steckbretteinträge mit unique letters
...@@ -127,24 +127,29 @@ public class DatenbankSqlite { ...@@ -127,24 +127,29 @@ public class DatenbankSqlite {
* Generiert einen String aus 10 * 2 unterschiedlichen Großbuchstaben * Generiert einen String aus 10 * 2 unterschiedlichen Großbuchstaben
* @return String => 10 Buchstabenkombinationen mit Komma getrennt * @return String => 10 Buchstabenkombinationen mit Komma getrennt
*//* *//*
private static String steckverbindung(){ private static String steckverbindung(){
Random rnd = new Random(); Random rnd = new Random();
String steckverbindung=""; String steckverbindung="";
char[] c = new char[2];
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 2; j++) { char[] c = new char[20];
c[j]= (char) (rnd.nextInt(26) + 'A'); for (int i = 0; i < 20; i++) {
if (j==1) { c[i] = (char) (rnd.nextInt(26) + 'A');
while (c[0] == c[j]) { for (int j = i; j >= 0; j--) {
c[j] = (char) (rnd.nextInt(26) + 'A'); if (i>j) {
} while (c[i]==c[j]) {
} c[i] = (char) (rnd.nextInt(26) + 'A');
} j= i-1;
System.out.println(c[0]+" / "+c[1]); }
steckverbindung+= ((""+c[0]) + (""+c[1]) +","); }
} }
steckverbindung= (String) steckverbindung.subSequence(0,steckverbindung.lastIndexOf(",")); }
return steckverbindung; steckverbindung = ((""+c[0]) + (""+c[1]) +"," +(""+c[2]) +(""+c[3]) + ","+(""+c[4]) +(""+c[5]) + ","+(""+c[6]) +(""+c[7]) + ","
}*/ +(""+c[8]) +(""+c[9]) + ","+(""+c[10]) +(""+c[11]) + ","+(""+c[12]) +(""+c[13]) + ","+(""+c[14]) +(""+c[15]) + ","+(""+c[16]) +(""+c[17]) + ","
+(""+c[18]) +(""+c[19]));
// System.out.println(steckverbindung);
// steckverbindung= (String) steckverbindung.subSequence(0,steckverbindung.lastIndexOf(","));
return steckverbindung;
}*/
//endregion //endregion
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment