-- Fallback: Unlikely case of floating point error:
returnoptions[Math.random(1,#options)]
end
-- A slightly more sophisticated raffle, taking a parameter which is used to vary the weights according to some rule. For example, the raffle could depend on the game completion progress.
--
---@param parameter number The parameter value to use for the raffle.
---@param data table Table with key-value pairs of the form option = {overall_weight, min_param, max_param, shape}, where:
--- - overall_weight: The weight of the option in the raffle.
--- - min_param: The minimum value of the parameter for which the option is eligible.
--- - max_param: The maximum value of the parameter for which the option is eligible.
--- - shape: An optional parameter for the shape of the weight curve with respect to the parameter. Defaults to 'flat', in which case the weight will be overall_weight as long as the parameter is within the range [min_param, max_param]. If 'bump', the weight is triangle-shaped: it has a peak of 2 * overall_weight at the midpoint of the range, and is zero at either end.