import random
# Define the outcomes and their probabilities
outcomes = [
("$5", 10),
("50% FREE PLAY", 20),
("BONUS", 20),
("100% BONUS", 10),
("10%", 10),
("$2%", 10),
("FREE PLAY", 10),
("BONUS", 10)
]
# Normalize probabilities to ensure they sum to 100
total_probability = sum(prob for _, prob in outcomes)
if total_probability != 100:
raise ValueError("Probabilities must sum to 100")
# Function to spin the wheel
def spin_wheel():
# Generate a random number between 0 and 99
spin = random.randint(0, 99)
cumulative_probability = 0
# Determine the outcome based on the spin
for outcome, prob in outcomes:
cumulative_probability += prob
if spin < cumulative_probability:
return outcome
# Spin the wheel and print the result
result = spin_wheel()
print(f"Spinning the wheel... You won: {result}")
Comments
Post a Comment