20 lines
624 B
Python
20 lines
624 B
Python
# lotterie/ziehung.py
|
||
# Modul für die eigentliche Lottoziehung
|
||
|
||
import custom_random
|
||
|
||
ZAHLEN_POOL = list(range(1, 46)) # Zahlen 1–45
|
||
|
||
|
||
def ziehe_zahlen(anzahl: int = 6) -> list[int]:
|
||
"""Zieht 'anzahl' verschiedene Lottozahlen aus dem Pool."""
|
||
gezogen = custom_random.sample(ZAHLEN_POOL, anzahl)
|
||
gezogen.sort()
|
||
return gezogen
|
||
|
||
|
||
def ziehe_zusatzzahl(ausgeschlossen: list[int]) -> int:
|
||
"""Zieht eine Zusatzzahl, die nicht in der Hauptziehung vorkommt."""
|
||
pool = [z for z in ZAHLEN_POOL if z not in ausgeschlossen]
|
||
return custom_random.randint(1, len(pool) - 1) # ← Index in pool, dann Lookup
|