def get_random_parameter_sampler(param_distributions, n_iter):
    """
    Sample parameters from given distributions.

    :param param_distributions : dict
        Dictionary where the keys are parameters and values
        are distributions from which a parameter is to be sampled by calling the disribution.
    :param n_iter : integer
        Number of parameter settings that are produced.
    :return: dict of string to any
        Yields dictionaries mapping each estimator parameter to
        as sampled value.
    """
    items = sorted(param_distributions.items())
    for _ in range(n_iter):
        params = dict()
        for k, v in items:
            params[k] = v()
        yield params
