import numpy as np
# Function to choose a multiplier between 1.2 and 30 with low probability for values over 5
def choose_multiplier():
multipliers = np.arange(1.2, 30.1, 0.1) # Generate values from 1.2 to 30 with 0.1 steps
# Define probabilities: higher values have lower probability
probabilities = np.array([1 if x <= 5 else 1/(x-4)**2 for x in multipliers])
probabilities /= probabilities.sum() # Normalize probabilities to sum to 1
return np.random.choice(multipliers, p=probabilities)
# Function to choose a number between 1 and 30 with low probability for values over 15
def choose_number():
numbers = np.arange(1, 31) # Generate numbers from 1 to 30
# Define probabilities: higher values have lower probability
probabilities = np.array([1 if x <= 15 else 1/(x-14)**2 for x in numbers])
probabilities /= probabilities.sum() # Normalize probabilities to sum to 1
return np.random.choice(numbers, p=probabilities)
# Example usage
multiplier = choose_multiplier()
number = choose_number()
print(f"Chosen multiplier: {multiplier}")
print(f"Chosen number: {number}")
To embed this program on your website, copy the following code and paste it into your website's HTML: