Class LottoZahlenGenerator
java.lang.Object
de.eldecker.dhbw.lottozahlen.engine.LottoZahlenGenerator
Klasse für das "Auswürfeln" eines Lottozahlen-Tipp für verschiedene Lottosysteme.
Für Tabelle mit verschiedenen Lottosystemen in verschiedenen Ländern siehe diese Wikipedia-Seite.
Für Tabelle mit verschiedenen Lottosystemen in verschiedenen Ländern siehe diese Wikipedia-Seite.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
Anzahl Zahlen für den zu erzeugenden Tipp, z.B. "6" für deutsches Zahlenlotto "6 aus 49".private int
Höchste Zahl im Lottosystem, z.B. "49" für deutsches Zahlenlotto "6 aus 49".private Random
Zufallszahlengenerator. -
Constructor Summary
ConstructorsConstructorDescriptionLottoZahlenGenerator
(int anzahlLottoZahlen, int maxLottoZahl) Convience-Konstruktor, siehe Beschreibung vonLottoZahlenGenerator(int, int, long)
.LottoZahlenGenerator
(int anzahlLottoZahlen, int maxLottoZahl, long initWertFuerZufall) Hauptkonstruktor, erzeugt Lottozahlengenerator für bestimmtes Lottosystem, z.B. "6 aus 49" (Deutschland) oder "6 aus 90" (Italien, SuperEnalotto). -
Method Summary
Modifier and TypeMethodDescriptionint[]
Zahlentipp für Lotto erzeugen.int
Getter für Anzahl der Zahlen in einem gültigen Tipp für das Lottosystem, für den das aufrufende Objekt erzeugt wurde.int
Getter für höchste Lottozahl des Lottosystems, für den das aufrufende Objekt erzeugt wurde.
-
Field Details
-
_zufallsgenerator
Zufallszahlengenerator. -
_anzahlLottoZahlen
private int _anzahlLottoZahlenAnzahl Zahlen für den zu erzeugenden Tipp, z.B. "6" für deutsches Zahlenlotto "6 aus 49". -
_maxLottoZahl
private int _maxLottoZahlHöchste Zahl im Lottosystem, z.B. "49" für deutsches Zahlenlotto "6 aus 49".
-
-
Constructor Details
-
LottoZahlenGenerator
public LottoZahlenGenerator(int anzahlLottoZahlen, int maxLottoZahl, long initWertFuerZufall) throws LottoException Hauptkonstruktor, erzeugt Lottozahlengenerator für bestimmtes Lottosystem, z.B. "6 aus 49" (Deutschland) oder "6 aus 90" (Italien, SuperEnalotto).- Parameters:
anzahlLottoZahlen
- Anzahl der Zahlen im Tipp, z.B. "6" bei deutschem Zahlenlotto "6 aus 49"; muss mindestens 1 seinmaxLottoZahl
- Höchste Lottozahl, z.B. "49" bei deutschem Zahlenlotto "6 aus 49"; muss mindestens 6 seininitWertFuerZufall
- Initialwert für Zufallsgenerator ("Seed")- Throws:
LottoException
- Ungültige Werte füranzahlLottoZahlen
odermaxLottoZahl
-
LottoZahlenGenerator
Convience-Konstruktor, siehe Beschreibung vonLottoZahlenGenerator(int, int, long)
.- Parameters:
anzahlLottoZahlen
- Anzahl der Zahlen im Tipp, z.B. "6" bei deutschem Zahlenlotto "6 aus 49"; muss mindestens 1 seinmaxLottoZahl
- Höchste Lottozahl, z.B. "49" bei deutschem Zahlenlotto "6 aus 49"; muss mindestens 6 sein- Throws:
LottoException
- Ungültige Werte füranzahlLottoZahlen
odermaxLottoZahl
-
-
Method Details
-
erzeugeTipp
public int[] erzeugeTipp()Zahlentipp für Lotto erzeugen.- Returns:
- Array mit Lotto-Tipp (aufsteigend sortiert)
-
getMaxZahl
public int getMaxZahl()Getter für höchste Lottozahl des Lottosystems, für den das aufrufende Objekt erzeugt wurde.- Returns:
- Höchste Lottozahl, z.B. "49" für deutsches Lotto "6 aus 49"
-
getAnzahl
public int getAnzahl()Getter für Anzahl der Zahlen in einem gültigen Tipp für das Lottosystem, für den das aufrufende Objekt erzeugt wurde.- Returns:
- Höchste Lottozahl, z.B. "6" für deutsches Lotto "6 aus 49"
-