generate_random_weighted
Select options randomly based on predefined weights for use in lottery systems, weighted item drops, task assignment, or A/B testing with customizable probability distributions.
Instructions
Weighted Random Selector
Randomly select an option based on weights
Args:
options (List[str]): List of options
weights (List[int]): Corresponding weight list (0-1000)
salt (str, optional): Random number salt value. Defaults to "".
Returns:
str: JSON string containing the selection result
Application Scenarios:
1. Lottery systems (prizes with different probabilities)
2. Random drops (weighted item drops)
3. Task assignment (based on priority)
4. A/B testing (experiment groups with different ratios)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
options | Yes | ||
salt | No | ||
weights | Yes |