import numpy as np def choose_multiplier(): """ Choose a multiplier between 1.2 and 30 with a low probability for values over 5. """ # Generate values from an exponential distribution and shift to fit the desired range while True: value = np.random.exponential(scale=1.5) + 1.2 # Exponential with scale=1.5 and shift to start at 1.2 if 1.2 <= value <= 30: return value def choose_number(): """ Choose a number between 1 and 30 with a low probability for values over 15. """ while True: value = np.random.exponential(scale=7) + 1 # Exponential with scale=7 and shift to start at 1 if 1 <= value <= 30: return int(round(value)) # Examples of usage multiplier = choose_multiplier() number = choose_number() print(f"Chosen multiplier: {multiplier:.2f}") print(f"Chosen number: {number}")