Last Updated: May 2025
Write a function to sample a certain number of elements from a multimodal distribution.
n: an integer representing the number of samples to be generated.keys: a list of any type representing the possible elements to be sampled from.weights: a list of floats representing the weights for each key.keys and weights lists must be equal.