Class LottoZahlenGenerator

java.lang.Object
de.eldecker.dhbw.lottozahlen.engine.LottoZahlenGenerator

public class LottoZahlenGenerator extends Object
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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private 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

    Constructors
    Constructor
    Description
    LottoZahlenGenerator(int anzahlLottoZahlen, int maxLottoZahl)
    Convience-Konstruktor, siehe Beschreibung von LottoZahlenGenerator(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 Type
    Method
    Description
    int[]
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _zufallsgenerator

      private Random _zufallsgenerator
      Zufallszahlengenerator.
    • _anzahlLottoZahlen

      private int _anzahlLottoZahlen
      Anzahl Zahlen für den zu erzeugenden Tipp, z.B. "6" für deutsches Zahlenlotto "6 aus 49".
    • _maxLottoZahl

      private int _maxLottoZahl
      Hö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 sein
      maxLottoZahl - Höchste Lottozahl, z.B. "49" bei deutschem Zahlenlotto "6 aus 49"; muss mindestens 6 sein
      initWertFuerZufall - Initialwert für Zufallsgenerator ("Seed")
      Throws:
      LottoException - Ungültige Werte für anzahlLottoZahlen oder maxLottoZahl
    • LottoZahlenGenerator

      public LottoZahlenGenerator(int anzahlLottoZahlen, int maxLottoZahl) throws LottoException
      Convience-Konstruktor, siehe Beschreibung von LottoZahlenGenerator(int, int, long).
      Parameters:
      anzahlLottoZahlen - Anzahl der Zahlen im Tipp, z.B. "6" bei deutschem Zahlenlotto "6 aus 49"; muss mindestens 1 sein
      maxLottoZahl - Höchste Lottozahl, z.B. "49" bei deutschem Zahlenlotto "6 aus 49"; muss mindestens 6 sein
      Throws:
      LottoException - Ungültige Werte für anzahlLottoZahlen oder maxLottoZahl
  • 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"